The useReducer Hook is similar to the useState Hook.
It allows for custom state logic.
It can be used to access a DOM element directly.
If you find yourself keeping track of multiple pieces of state that rely on complex logic, useReducer may be useful.
The useReducer Hook returns the current stateand a dispatchmethod.
const [todos, dispatch] = useReducer(reducer, initialTodos);
The useReducer Hook is similar to the useState Hook.
It allows for custom state logic.
It can be used to access a DOM element directly.
If you find yourself keeping track of multiple pieces of state that rely on complex logic, useReducer may be useful.
The useReducer Hook returns the current stateand a dispatchmethod.
const [todos, dispatch] = useReducer(reducer, initialTodos);