
React๋ UI๋ฅผ
interativeํ๊ฒ ๋ง๋ค์ด์ค๋ค.
HTML์์ ์ฌ์ฉํ๋ ๋ฌธ๋ฒ๊ณผ ํก์ฌํ ๋ฌธ๋ฒ์ ์ฌ์ฉํด HTML ์์๋ฅผ ๋ง๋ค ์ ์๋ค.
createElement ๋์ ์ฌ์ฉ.Babel์ ์ค์นํด์ฃผ์ด์ผ ํจ.Babel : JSX๋ก ์ ์ ์ฝ๋๋ฅผ ๋ธ๋ผ์ฐ์ ๊ฐ ์ดํดํ ์ ์๋ ํํ๋ก ๋ณํํด์ค.์์
const title = <h3 id="title">hello!</h3>
</> ์์ ๋ฃ์ด์ค๋ค.
์ฃผ์ :
1. ์ปดํฌ๋ํธ์ ์ฒซ ๊ธ์๋ ํญ์ ๋๋ฌธ์์ฌ์ผ ํ๋ค.
-> ์๋ฌธ์๋ก ์์ํ๋ฉด HTML ํ๊ทธ๋ก ์ธ์ํจ.
2. ์ปดํฌ๋ํธ๋ ํจ์๋ก ๋ง๋ค์ด์ฃผ์ด์ผ ํ๋ค.
const Title = () => {
<h1>hello!</h1>
}
const Button = () => {
<button onClick = {()=>{color : red}}>
click me
</button>
}
const Container = (
<div>
<Title/>
<Button />
</div>
)
node -v, npx command ์คํํ์ธnode -v ๋ก ๋ฒ์ ํ์ธ. npx๋ ์ ๋๋์ง ํ์ธ.npx create-react-app ํ๋ก์ ํธ์ด๋ฆ
ํน์ npm install -g create-react-app, create-react-app ํ๋ก์ ํธ ์ด๋ฆ
code ํ๋ก์ ํธ์ด๋ฆ
npm start