reading-notes


Project maintained by mr-atta Hosted on GitHub Pages — Theme by mattgraham

Advanced State with Reducers


<hr>

Review, Research, and Discussion

How can we ensure that an effect hook runs only once ❓ πŸ“

If we pass an empty array [] , it just renders the component only once like componentDidMount.

Can useState() update more than one state variable at the same time ❓ πŸ“

Unlike the setState in class components, the setState returned from useState doesn’t merge objects with existing state, it replaces the object entirely.

Is useState() synchronous ❓ πŸ“

useState and setState both are asynchronous. They do not update the state immediately but have queues that are used to update the state object.



useReducer

Ultimate Guide to useReducer

How does useReducer work?



πŸ“ useReducer hook
πŸ“ Ultimate Guide to useReducer