Restructuring the State Object
Explore techniques to restructure the Redux state object by representing users and contacts as objects with unique IDs. Understand how to connect messages to users for clearer state organization and prepare for advanced state handling in your React applications.
We'll cover the following...
We'll cover the following...
In the previous lesson, we decided to make our Messages and Contacts components independent.
We now need to figure out a way to connect the two in order to know which messages belong to which user.
Here’s one way to handle this:
So, all I’ve done is make the messages field an array of message objects. These objects will have a messageTo key.
This key shows ...