#3 Create Multiple Reducers | Combine Reducers | Action Creators | Redux Tutorial for Beginners

preview_player
Показать описание
Combine Reducers | Actions | Action Creators | CombineReducers | Redux Tutorial for Beginners | Learn Redux without React | best explanation | Training Course | Simple | Basics |

******* CURRENT PLAYLIST ******

******* PLEASE STAR MY REPO TO SUPPORT ME ******

******* Social Links ********

Please follow 🙏

Twitter - @imranhsayed

Github - imranhsayed

******* Other Playlist ******

==== REACT TUTORIALS ====

==== REDUX TUTORIALS ====

==== REACT WITH WORDPRESS TUTORIALS ====

==== WEBPACK TUTORIALS ====

Babel Introduction

Webpack Installation
Рекомендации по теме
Комментарии
Автор

Another Question: How does the second action call "getUserAge()" know about the "name" in your state? In your reducerUser you are passing it the state which is empty (state={}) and when you dispatch the getUsername() action it passes the "name" payload to the empty initial state in reducerUser then it sets the state to state={name: "Imran"} right? But then when you dispatch the second action it goes through the reducerUser again and since the action.type === "JOB_DETAIL" it appends age: 28 to the state. How does getUserAge() have both name and age in its state? I would think that when getUserAge goes through the reducerUser the state is back to empty since you have "state={}" as one of your parameters? Does the state not get set back to empty?

I hope my question is clear. Thanks in advance!

DOUBLESEVUN
Автор

Does each reducer hold its own separate state? I see in your console that the store has the "jobDetails" and "userDetails" reducers and they each have their own state ( jobDetails: ={job: "Web Developer} and userDetails: {name:"Imran", age: 28} ). Or am I looking at this wrong?

DOUBLESEVUN