Sunday, 4 August 2024

React JS - Redux Flow Diagram and Steps

 








Steps of Redux
1.) Create Action
2.) Create Reducer
3.) Create Root Reducer ---> combine all reducer in one file
4.) Create Store
5.) Inject store to App component, wrap app with provider in app component and pass store as property
6.) use hook useSelector to directly access state---->used to display state value that are hold by redux store
7.) use hook useDispatch give directly dispatch access.
--> Send action by using dispatch method.
--> You can update state value by using useDispatch hook

Note: 

1.) MapStateToProps and mapDispatcchToProps are old redux method
2.) useDispatch and useSelector hook use in your normal component whereever you needed.



No comments:

Post a Comment

React Hooks - custom Hook

  v CustomHook Ø React allows us to create our own hook which is known as custom hook. Example – 1 localStorage Demo Step-1 Create ...