Consider dropping Reselect's association with Redux?
Reselect is truly amazing (thank you for writing it and maintaining it – I love using it!), but it is described as a selector library for Redux even though there is no real connection between the two. To give an analogy, it is like if axios was advertised as "HTTP requests for Redux!" It just wouldn't really make sense to describe axios that way 😅
I have two specific concerns with the current description of the lib:
- someone comes to the README, sees Redux in the description, and thinks, "ok this isn't me," and then they do not use it, even though it actually does make sense for their use case
- someone determines it is more generic than for use with redux, uses it in an app that is not using Redux, and then another developer comes to check out the README here and gets really confused (this is a major concern for me at work. I want to build applications that future developers can understand easily, as our applications tend to last a long time and sometimes they change teams).
Looking through the issues, it appears that the description misleads people sometimes:
- https://github.com/reactjs/reselect/issues/303
- https://github.com/reactjs/reselect/issues/334
The people who open these issues are the ones who, presumably, read the README after reading the description. I am sure most people would read the description and just turn away. That's what I do if I stumble upon a library that says, say, "XYZ for Relay," as I am not currently using Relay in any projects. I wouldn't browse the README while thinking, "Hm, well maybe I can make this work outside of Relay projects, too."
I'm thinking it would help folks find this awesome lib if it were more accurately described. I understand it was originally designed specifically for Redux, which is cool, but I think having a section of the guides about integration with Redux (like this one) is probably enough.
One idea would be to look at how Redux documents its relationship to React. Redux doesn't say "State management for React." It describes itself as a predictable state container for JavaScript apps. But it has a dedicated section about React in its docs, and one of the first lines of the docs is:
You can use Redux together with React, or with any other view library.
I think an approach like this would make more sense for Reselect.
As an aside, Reselect also has nothing to do with React, so one could argue that it being in the reactjs org is potentially misleading, too, but I think that is less of a problem.
Because this isn't a breaking API change or anything, I don't foresee there being any negatives to it. I think it would just clear things up.
This was suggested way back in https://github.com/reactjs/reselect/issues/30 , but I don't think that enough progress has been made. If there is interest, I would be happy to give a pass at restructuring the documentation to focus more on its generic nature.
What do folks think? 🤔
Thanks for reading! And thanks again for this amazing library! 👌 🎉
Thanks for bringing this up. It looks like reselect will be moving to the redux org soon, so as part of that change I think it would be sensible to revisit the readme as otherwise it will seem like the association is even stronger. I would love it if you would take a pass at the docs!
Cool, I will do that @ellbee !
Nice thought. We use Reselect to compose components' view model, our selectors that read component instance's props (React) or @Inputs() (Angular 2+), and we use series of selectors to compose the component's view model (or in React's new lingo derived state). We have found Reselect is amazing as it helps breakdown the complexity and provides performance aids in most scenarios with its memoization feature.
That being said, the point I try to make is that Reselect is not just for Redux, it can be used standalone!
I find it really confusing that the documentation describe the selectors as being parameterizable only by state and React props. I don't understand why the second parameter has to be an object representing some react component's props instead of an options object describing the parameters you are sending to the selector. You can use the selectors (and I saw you are actually advised) inside of thunks, containers and other places where those options have sense without being dependent on the internal structure of your React components.
Gonna close this issue as I never had time to update the docs and won't have time in the future. Feel free to reopen if anyone feels strongly about this issue ✌️