I'm writing my first Redux app. In my store, I have ~300-500 Island objects that I retriev from an API and index by an id string in an object (being treated like a map). When I'm editing one of these Islands by setting editId in the store, the buttons for the other Islands need to be disabled. I can think of three ways I can do this.
- Have all of the components watch
editIdfor changes and check theirIsland.idagainst theeditId(I'm guessing this is very slow) - Add a
disabledprop to my island component, have the container that maps theIslands to components watch foreditId, and calculatedisabledfor each island on render - Add a
disabledfield to theIslandobjects in the store and update each of these objects when my edit action
My hunch is option 2, as that would definitely be the cleanest approach.
This question is coming from a place of migrating from mobx (which had terrible performance) to redux, and hoping performance improves. If any of the three of these will have virtually the same performance, then I'll choose option 2. I just don't know if there's a redux pattern established that I should be using.