# Function useReducer

- useReducer<R, I>(reducer, initializerArg, initializer): [ReducerStateWithoutAction<R>, DispatchWithoutAction]

- An alternative to `useState`.

  `useReducer` is usually preferable to `useState` when you have complex state logic that involves multiple sub-values. It also lets you optimize performance for components that trigger deep updates because you can pass `dispatch` down instead of callbacks.

  #### Type Parameters

  - R extends ReducerWithoutAction<any>
  - I

  #### Parameters

  - reducer: R
  - initializerArg: I
  - initializer: ((arg) => ReducerStateWithoutAction<R>)
    - - (arg): ReducerStateWithoutAction<R>

      - #### Parameters

        - arg: I

        #### Returns ReducerStateWithoutAction<R>

  #### Returns [ReducerStateWithoutAction<R>, DispatchWithoutAction]

  #### Version

  16.8.0

  #### See

  https://react.dev/reference/react/useReducer

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1889
- useReducer<R>(reducer, initializerArg, initializer?): [ReducerStateWithoutAction<R>, DispatchWithoutAction]

- An alternative to `useState`.

  `useReducer` is usually preferable to `useState` when you have complex state logic that involves multiple sub-values. It also lets you optimize performance for components that trigger deep updates because you can pass `dispatch` down instead of callbacks.

  #### Type Parameters

  - R extends ReducerWithoutAction<any>

  #### Parameters

  - reducer: R
  - initializerArg: ReducerStateWithoutAction<R>
  - `Optional` initializer: undefined

  #### Returns [ReducerStateWithoutAction<R>, DispatchWithoutAction]

  #### Version

  16.8.0

  #### See

  https://react.dev/reference/react/useReducer

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1905
- useReducer<R, I>(reducer, initializerArg, initializer): [ReducerState<R>, Dispatch<ReducerAction<R>>]

- An alternative to `useState`.

  `useReducer` is usually preferable to `useState` when you have complex state logic that involves multiple sub-values. It also lets you optimize performance for components that trigger deep updates because you can pass `dispatch` down instead of callbacks.

  #### Type Parameters

  - R extends Reducer<any, any>
  - I

  #### Parameters

  - reducer: R
  - initializerArg: I & ReducerState<R>
  - initializer: ((arg) => ReducerState<R>)
    - - (arg): ReducerState<R>

      - #### Parameters

        - arg: I & ReducerState<R>

        #### Returns ReducerState<R>

  #### Returns [ReducerState<R>, Dispatch<ReducerAction<R>>]

  #### Version

  16.8.0

  #### See

  https://react.dev/reference/react/useReducer

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1923
- useReducer<R, I>(reducer, initializerArg, initializer): [ReducerState<R>, Dispatch<ReducerAction<R>>]

- An alternative to `useState`.

  `useReducer` is usually preferable to `useState` when you have complex state logic that involves multiple sub-values. It also lets you optimize performance for components that trigger deep updates because you can pass `dispatch` down instead of callbacks.

  #### Type Parameters

  - R extends Reducer<any, any>
  - I

  #### Parameters

  - reducer: R
  - initializerArg: I
  - initializer: ((arg) => ReducerState<R>)
    - - (arg): ReducerState<R>

      - #### Parameters

        - arg: I

        #### Returns ReducerState<R>

  #### Returns [ReducerState<R>, Dispatch<ReducerAction<R>>]

  #### Version

  16.8.0

  #### See

  https://react.dev/reference/react/useReducer

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1939
- useReducer<R>(reducer, initialState, initializer?): [ReducerState<R>, Dispatch<ReducerAction<R>>]

- An alternative to `useState`.

  `useReducer` is usually preferable to `useState` when you have complex state logic that involves multiple sub-values. It also lets you optimize performance for components that trigger deep updates because you can pass `dispatch` down instead of callbacks.

  #### Type Parameters

  - R extends Reducer<any, any>

  #### Parameters

  - reducer: R
  - initialState: ReducerState<R>
  - `Optional` initializer: undefined

  #### Returns [ReducerState<R>, Dispatch<ReducerAction<R>>]

  #### Version

  16.8.0

  #### See

  https://react.dev/reference/react/useReducer

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1964