본문 바로가기
Frontend#Frontend#React조회 20

useReducer란?

정의

복잡한 상태 전이를 reducer 패턴으로 다루는 React 훅. useState의 강화판.

useReducer란?

const [state, dispatch] = useReducer(reducer, initial);

useState 대신 선택 기준

  • 상태 객체가 복잡
  • 다음 상태가 이전 상태에 의존
  • 액션 기반 업데이트 (type·payload)

Redux와 같은 패턴이지만 컴포넌트 로컬에서.

🔗 함께 보면 좋은 용어

Frontend 전체 →