커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
jsx변수 질문
[왕초보] 나만의 수익성 앱, 앱개발 종합반
2주차
북마크
김*지
댓글
4
추천
0
조회수
12
조회수
12
답변 완료

안녕하세요 2-6강 질문이있습니다

  1. 이미지변수인 main은 app()함수밖에 선언하고 tip,todayWeather등 변수는 app()의 return밖에서 선언하던데 둘이 차이가 뭔가요?? 전역변수,지역변수 이런건가요?
  2. jsx에서 변수를 사용시 중괄호를 사용하라고 하셨는데 todayWeather을 사용할때는 중괄호를 이용하고 <Text style={styles.weather}>오늘의 날씨: {todayWeather + '°C ' + todayCondition} </Text> ,main을 사용할때는 그냥쓰는이유가 뭔가요??  <Image style={styles.mainImage} source={{uri:main}}/>


import React from 'react';
import { StyleSheet, Text, View, Image, TouchableOpacity, ScrollView} from 'react-native';


const main = 'https://firebasestorage.googleapis.com/v0/b/sparta-image.appspot.com/o/lecture%2Fmain.png?alt=media&token=8e5eb78d-19ee-4359-9209-347d125b322c'


import data from './data.json';
// 다른파일불러오기


export default function App() {
  let tip = data.tip; 
  let todayWeather = 10 + 17;
  let todayCondition = "흐림"
  //return 구문 밖에서는 슬래시 두개 방식으로 주석
  return (
    /*
      return 구문 안에서는 {슬래시 + * 방식으로 주석
    */
    <ScrollView style={styles.container}>
      <Text style={styles.title}>나만의 꿀팁</Text>
      <Text style={styles.weather}>오늘의 날씨: {todayWeather + '°C ' + todayCondition} </Text>
      <Image style={styles.mainImage} source={{uri:main}}/>
취소
 공유
취소
댓글 0
댓글 알림
나의얼굴