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.
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.