์ƒํƒœ๊ด€๋ฆฌ

๐Ÿ‘จ๐Ÿป‍๐Ÿผ useState ํŠน์ • ๊ฐ’์„ useState()๋กœ ์„ ์–ธํ•˜์—ฌ์„œ ๊ฐ’์˜ ์ƒํƒœ๋ฅผ ๊ด€๋ฆฌํ•˜๊ณ , ํ•ด๋‹น ๊ฐ’์˜ ์ƒํƒœ๊ฐ€ ๋ณ€๊ฒฝ๋˜๋ฉด ํ™”๋ฉด์„ ๋ฆฌ๋ Œ๋”๋งํ•˜์—ฌ ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ๋ณด์—ฌ์ค€๋‹ค. ์ด๋•Œ, ๋ฆฌ๋ Œ๋”๋ง์ด ์ผ์–ด๋‚˜๋Š” ์ปดํฌ๋„ŒํŠธ์— ์ž์‹ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์žˆ๋‹ค๋ฉด, ์ž์‹ ์ปดํฌ๋„ŒํŠธ ๋˜ํ•œ ๋‹ค์‹œ ๋ถˆ๋Ÿฌ์™€์ง€๋ฉด์„œ ์ž์‹ ์ปดํฌ๋„ŒํŠธ๊นŒ์ง€ ๋ฆฌ๋ Œ๋”๋ง ๋ฉ๋‹ˆ๋‹ค. ๐Ÿ’ป Code ๋ฆฌ์•กํŠธ ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“ค๊ณ , ๋‹ค์Œ ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด์ค€๋‹ค. ๐Ÿ“„ StateComponent.tsx import React, { useState } from 'react' export function StateComponent(): JSX.Element { const [num, setNum] = useState(0) const onIncrease = () => setNum(num + 1) const onDec..
ma.caron_g
'์ƒํƒœ๊ด€๋ฆฌ' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก