React-redux vs Broken telephone game

React-redux vs Broken telephone game

At the beginning of my React-experience, I was confused about props and how to use it. Props turned out to be very much like the broken telephone game when you have to call on props between different components. And what started as you asking for cheese in one component could end with you getting a displease


So how can we simplify this? And how can we cut the middleman? 

The answer is React-redux!

 

Store => In the store, we can access all of our components, and it's states. So instead to whisper to the person next in line what I want to order, I can directly go to the store to get what I want. 

Provider => is like the storefront where we can see all the components and how we want them to render on the webpage. 

Reducer => reminds me of a warehouse where we can place our initial states, and it is full of if/else conditions. 

Actions => are payloads of information that send data from the application to the store. It's like an order confirmation, with your intention to buy. 

Dispatch => This is the only way to trigger a state change, which lets you create functions that dispatch when called and pass those functions as props to your component. To simplify, think of a balance sheet: letting the warehouse know that it's going to be some change in the stock so that the product can be sent to the buyer.


To view or add a comment, sign in

More articles by 🐫 Tuliany Grande ✨

Insights from the community

Others also viewed

Explore topics