You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*지연 초기화
🧑🏻🎨 일반 방식 - 매 렌더링마다 expensiveComputation() 실행
const [state, setState] = useState(expensiveComputation());
🧑🏻🎨 지연 초기화 - 첫 렌더링 때만 실행
const [state, setState] = useState(() => expensiveComputation());
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
useState는 어떤 기능을 할까?
초기값 설정
상태 업데이트
setState(5)setState(prev => prev + 1)불변성 비교
클로저 활용
배치 업데이트
setState호출 시Beta Was this translation helpful? Give feedback.
All reactions