Purpose of useReducer hook in React
The useReducer hook is a state management hook in React that provides an alternative to the useState hook. It is used when the state of a component is complex and requires more than one state variable. Syntax:const [state, dispatch] = useReducer(reducer, initialState, init)reducer: The reducer is a