coodoo / react-redux-isomorphic-example

An isomorphic example built with react and redux , see readme for detailed instructions
425 stars 76 forks source link

Consider a more normalized data shape #10

Closed gaearon closed 9 years ago

gaearon commented 9 years ago

I was looking at products, and its data shape is { all: [array of products], currentProduct: product }. Wouldn't it be better to normalize it to { productsById: { id -> product }, fetchedProductIds: [array of ids], currentProductId: id }? This would avoid duplicate state, and thus make features like editing, deleting, pagination easier. You can use https://github.com/gaearon/normalizr to help with this.

coodoo commented 9 years ago

Yep that's exactly what I planned to do next, along with introducing immutablejs to the example.

coodoo commented 9 years ago

Migrated the example to use `immutablejs".