Search⌘ K

Identifying the Relationships

Explore how to identify the primary fields in your Redux state object that require frequent operations such as create, read, update, and delete. Understand how positioning these "front runner" fields improves state management and helps clarify relationships, like linking messages to contacts, to support accurate data rendering in your application.

We'll cover the following...

In the last lesson, we designed a basic implementation of our app’s state:

Javascript (babel-node)
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 ...