useReducer Hook is another built in Hook in React to handle complex state management.
if your component has simple states like string, boolean then useState Hook is sufficient and you used use this only but as project grow, complexity also increase and in that case handling states with useState will be tough, there useReducer Hook will be better option.
useReducer takes 3 parameters ,
1) reducer function (required parameter ): redux is a pure function that takes previous state and action an argument and return the next state.
2) Initial State:(required parameter ) With this state, you reducer will initialise
3) init function(optional): if you pass third parameter, then it will initialise the initial state lazily.
Watch the complete video till the end to understand core of useReducer hook with basic Todo App.
Support the channel by liking this video and share in your network if you learnt something new :)
Checkout my Instagram account to find the latest notes on React, Angular and Javascript.
Instagram handler Name: @nishasingla05
Watch complete video to understand in depth.
Support my channel by liking and sharing my videos so that I can reach to wider audience.
►Checkout previous video useState Hook (part-2)
• useState Hook in React...
►Checkout previous video useState Hook (part-1)
• useState Hook in React...
►Checkout previous video Hooks
• Hooks in ReactJS: Wha...
►Project Setup using create-react-app
• ReactJS Tutorial: What...
►Virtual DOM and Real DOM
• ReactJS Tutorial: What...
►ReactJS Introduction
• ReactJS Tutorial - Int...
►Click here to Subscribe the channel:
studio.youtube....
►All important shorts videos:
ru-vid.com....
Connect with Me On Social Media
Facebook: / angularjs4be. .
LinkedIn: / nisha-sin. .
Instagram : / nishasingla05
Twitter: / nishasingla05
#nishasingla #javascript #reactjs
29 сен 2024