useReducer - A Bring Your Own State Managment Logic Hook in React
In addition to the useState Hook, there is the useReducer Hook in React. It allows for the creation of custom state logic. useReducer may be useful if you have to track multiple pieces of state involving complex logic. The useReducer Hook accepts two arguments. Syntax: useReducer(<reducer>, <initialState>) The reducer function contains your custom state logic and the initialState can be a simple value but generally will contain an object. The useReducer Hook returns the current state and a dispatch method....