Replies: 8 comments
-
This will also break backwards compatibility to all projects have used reselect and re-reselect with NGRX. |
Beta Was this translation helpful? Give feedback.
-
Hi @yzhe554 I didn't think of reselect and re-reselect. If that's the case, then how does this deprecation affect this? |
Beta Was this translation helpful? Give feedback.
-
@timdeschryver thanks for replying. I didn’t use ngrx/createSelector because reselect/createSelector had wider features |
Beta Was this translation helpful? Give feedback.
-
I see, thanks for the elaboration. |
Beta Was this translation helpful? Give feedback.
-
Yes, the only other thing is, you don't have to always use selector factory. For example, I have a todo list and in the page, I have header and content both only display the the todo with id 1.
Firstly, if we run it twice, one in header and one in content components, we are holding two references while it's only one for props. Secondly, if I need to compose selectors, this will make all selectors to be selector factory, which will add boilerplate. As you have mentioned in #2980, we only need to use a selector factory/re-reselect when we are displaying more than one item in the view. i.e
|
Beta Was this translation helpful? Give feedback.
-
@Denhai yeh. We can also see people mentioned re-reselect in that issue. |
Beta Was this translation helpful? Give feedback.
-
We're still in favor of removing selectors with props. |
Beta Was this translation helpful? Give feedback.
-
Dear NGRX maintainers,
I have seen the recent changes for deprecating props from selector. #2980
The very first question is: do we need to write a factory selector when we want an argument? In another word, is props the same to arguments?
My understanding is No.
https://github.com/reduxjs/reselect/tree/v4.0.0#accessing-react-props-in-selectors
If you only display one single instance in the UI, you won't need a factory selector. It's adding a lot of complexities when you need to use it across multiple selectors/components. This is where props make things so easier.
If you will need to display multiple instances, like the example from reselect, yes, we cannot just use props here. This is where factory selectors come.
But it's really common in redux community that a better solution(rereselect) has been created.
https://redux.js.org/usage/deriving-data-selectors#re-reselect
I really suggest we reconsider this change.
Beta Was this translation helpful? Give feedback.
All reactions