useState()์‚ฌ์šฉ๋ฒ•

ยท React
์˜ˆ์ „์—๋Š” ๊ทธ๋ƒฅ let post = '์–ด์ฉŒ๊ตฌ' ์ด๋Ÿฐ์‹์œผ๋กœ ๋ณ€์ˆ˜์— ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ–ˆ์—ˆ๋Š”๋ฐ ๋ฆฌ์•กํŠธ์—์„œ๋Š” ๋ณ€์ˆ˜๋ง๊ณ  state ๋ฅผ ๋งŒ๋“ค์–ด์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•ด๋‘˜ ์ˆ˜ ์žˆ์–ด์š” import { useState } from 'react'; import './App.css' function App(){ let [a,b] = useState('๋‚จ์ž ์ฝ”ํŠธ ์ถ”์ฒœ'); return ( ๊ฐœ๋ฐœ blog {a} 2์›” 17์ผ ๋ฐœํ–‰ ) } 0. ๋งท์œ—์ค„์— import {useState} from 'react' 1. useState('๋ณด๊ด€ํ• ์ž๋ฃŒ') ๋ผ๊ณ  ์“ฐ๋ฉด state์— ์ž๋ฃŒ๋ฅผ ์ž ๊น ์ €์žฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค 2. ์ด state๋ฅผ ์“ฐ๊ณ  ์‹ถ์œผ๋ฉด, let[a,b] = useState('๋‚จ์ž ์ฝ”ํŠธ ์ถ”์ฒœ'); a ์ž๋ฆฌ์— state ์ด๋ฆ„์„ ์ž์œ ๋กญ๊ฒŒ ์ž‘๋ช…ํ•œ ๋‹ค์Œ ..
becky(์ง€์€)
'useState()์‚ฌ์šฉ๋ฒ•' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก