@lynx-js/react / useReducer
Function: useReducer()
useReducer(reducer, initializerArg, initializer)
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
Parameters
Returns
[ReducerStateWithoutAction<R>, DispatchWithoutAction]
Version
16.8.0
See
https://react.dev/reference/react/useReducer
Defined in
.pnpm/@types+react@18.3.11/node_modules/@types/react/ts5.0/index.d.ts:1896
useReducer(reducer, initializerArg, initializer)
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
Parameters
Returns
[ReducerStateWithoutAction<R>, DispatchWithoutAction]
Version
16.8.0
See
https://react.dev/reference/react/useReducer
Defined in
.pnpm/@types+react@18.3.11/node_modules/@types/react/ts5.0/index.d.ts:1912
useReducer(reducer, initializerArg, initializer)
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
Parameters
Returns
[ReducerState<R>, Dispatch<ReducerAction<R>>]
Version
16.8.0
See
https://react.dev/reference/react/useReducer
Defined in
.pnpm/@types+react@18.3.11/node_modules/@types/react/ts5.0/index.d.ts:1930
useReducer(reducer, initializerArg, initializer)
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
Parameters
Returns
[ReducerState<R>, Dispatch<ReducerAction<R>>]
Version
16.8.0
See
https://react.dev/reference/react/useReducer
Defined in
.pnpm/@types+react@18.3.11/node_modules/@types/react/ts5.0/index.d.ts:1946
useReducer(reducer, initialState, initializer)
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
Parameters
Returns
[ReducerState<R>, Dispatch<ReducerAction<R>>]
Version
16.8.0
See
https://react.dev/reference/react/useReducer
Defined in
.pnpm/@types+react@18.3.11/node_modules/@types/react/ts5.0/index.d.ts:1971