Lazily derive reducer state.
Section: State Hooks
useReducer with init function
tsx
tsx
const [state, dispatch] = useReducer(reducer, initialArg, init);Explanation
The third `init` argument lazily computes the initial reducer state.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing State Hooks