useState1 useState 1. 소개 useState는 React에서 제공하는 hook으로 컴포넌트의 상태를 생성하고 업데이트한다. useState – React The library for web and native user interfaces react.dev 2. 사용법 import { useState } from 'react'; function ExampleComponent() { const [count, setCount] = useState(0); return ( {count} setCount(count + 1)}> 증가 ); ); 사용법은 간단하다 배열로 선언해 주고 첫 번째 인자로 값을 읽고 두 번째 인자로 값을 업데이트한다. 3. Principles for structuring state 상태를 사용할 때 어떻게 상.. 2024. 2. 13. 이전 1 다음