4/11/2023 0 Comments Iconmenu redux example![]() ![]() One way to solve this problem is to take state outside of the component tree and set it as centralized. and then you can use this state in the 3rd component.īut that does not help always because in large application there are many states needed to be used in many different components, so it is not the best practice. ![]() So you can lift state from 2nd component to the app.js file. This can be solved by “lifting up” the state to the parent component. So the problem is when multiple components that need to share and use the same state. Now the problem occurs when the neighbor component which is 3 want to access that data state. You can use this data state in child components by directly passing them downwards. Here, you have fetched the data from an API and you save it in the state of 2nd component. Let’s say as a root component you have app.js file in your project, and in the component tree, the first layer contains 3 components and in the 2nd layer there are two child component of 2nd component. If you prefer to watch video then here it is else you can keep reading □!īefore going into what is Redux? Let's see why we needed Redux in the first place. I have spent many days to make this tutorials more simple and easy to understand. I was getting lot's of messages to create tutorials on Redux! So here it is. It's been a while I have created anything.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |