Design normalized state for efficient updates.
State structure:
{
posts: {
byId: { '1': { id, authorId, content, ... } },
allIds: ['1', '2', '3']
},
users: {
byId: { '10': { id, name, avatar } }
},
feed: {
postIds: ['3', '1', '2'],
cursor: 'abc123',
hasMore: true
},
ui: { isLoading: false, error: null }
}
Why normalize: A user appears in many posts. Update their name once, reflected everywhere.