Define the shape of your application state.
Questions to answer:
- What entities exist? (users, posts, comments)
- How are they structured?
- What's the relationship between entities?
- What's local state vs global state?
Example for a feed:
{
posts: { byId: {}, allIds: [] },
users: { byId: {}, currentUserId: null },
ui: { isLoading: false, error: null }
}
Normalized state (byId/allIds pattern) prevents duplication and simplifies updates.