[React/Redux] Logicless Components with Reselect
Why Stack Overflow recommends it
Stack Overflow users link it when explaining what Reselect selectors are for and when to use them to combine pieces of Redux state.
Recommended by 1 people across 1 different months, 2016 to 2018.
What it is
A short tutorial by Stephen Grider on using Reselect in a React/Redux app. He builds a multi-select list UI to show how selectors combine existing pieces of state and pull repetitive logic out of components.
What people said
Recommends Puerto · 2018-06 · Stack Overflow · on “Firebase Database relationship issue - storing selected items for users”
So I have gone through this. Bryan got me part of the way there so I upvoted his response but Im posting the full answer here so others may benefit. I tried to keep the initial question as boiled down as I could but I realize that is difficult and this is maybe not the best forum but I couldn't find the answer anywhere else and I had specific use case which I can share more now with code. Use case to summize. I have Items stored in firebase. User is going to select from items. I need to store what they select but keep the data as maintainable as possible. Bryan suggested store only the key which is fine. But I was displaying what the user selected in a div in the UI so essentially if I didn'
Cites Kokovin Vladislav · 2016-06 · Stack Overflow · on “Redux: Normalizing Global State”
you should avoid nesting . quote from redux docs: In a more complex app, you’re going to want different entities to reference each other. We suggest that you keep your state as normalized as possible, without any nesting. Keep every entity in an object stored with an ID as a key, and use IDs to reference it from other entities, or lists. Think of the app’s state as a database. This approach is described in normalizr's documentation in detail. For normalize state you can use normalizr [LINK] pages:{ items:{ 1:{id: 1,title: "dorrisPage", posts:[33,57]} 2:{id: 2, title: "anotherPage",posts:[57]} }, isFetching: false, itemIds:[1,2,..] }, posts:{ items:{ 33:{id: 33,title: "Post33", comments:[1,2]
Cites Paschalidis Christos · 2017-04 · Stack Overflow · on “How to use reselect in react-boilerplate”
I am using react-boilerplate , and I am building a small kind of project so that I can understand the use of selectors. I watched this video [this video] which I enjoyed a lot and I believe I have a clear understanding of where I should use selectors. So what the video says is that we should use selectors when we want to combine 2 or more states of redux and as a result have a combined state (always correct me if I am wrong please). So given that definition, I have the following questions, While using the boilerplate should I use selectors even if I don't have to combine 2 or more states? For example, I have written the following selector const selectCardRendererDomain = () => (state) => state.ge