Identifying the Relationships
As we develop a better understanding of the different components of our app, the design of our state object improves.
We'll cover the following...
In the last lesson, we designed a basic implementation of our app’s state:
Press + to interact
const state = {user: [{contact1: 'Alex',messages: ['msg1','msg2','msg3']},{contact2: 'john',messages: ['msg1','msg2','msg3']}]}
This is a pretty good representation of our data. It seems like it shows the relationship between each entity, but in terms of the state of your frontend application, this is a bad idea. Bad is a strong word. Let’s just say, there’s a better way to do this.
Here’s how I see it.
If you had to manage a football team, a good plan will be to pick out the best scorers in the team, and put them in the front to ...