<hr>
If we pass an empty array [] , it just renders the component only once like componentDidMount.
Unlike the setState in class components, the setState returned from useState doesnβt merge objects with existing state, it replaces the object entirely.
useState and setState both are asynchronous. They do not update the state immediately but have queues that are used to update the state object.
const [state, dispatch] = useReducer(reducer, initialArg, init);