jumpsuit / jumpstate

Jumpstate is a simple and powerful state management utility for Redux.
MIT License
425 stars 22 forks source link

Using reselect (state selectors, derived data) #41

Closed matuscongrady closed 7 years ago

matuscongrady commented 7 years ago

Hello,

I recently started using jumpstate. The first problem I encountered was lack of selectors.

Have you considered Reselect: https://github.com/reactjs/reselect integration? Is there some other way to use selectors? Have anyone came up with a working solution?

If so, please provide us with an idiomatic way to use them (and consider adding it to the documentation/examples).

Thanks!

FoxxMD commented 7 years ago

@ugros Why did you close this? Did you find a solution for using reselect?

tannerlinsley commented 7 years ago

Sorry. The reason for closing that selectors do currently work in jumpstate and there are no immediate plans to abstract them or ingest them into jumpstate

On Fri, Jul 14, 2017 at 7:35 AM Matt Foxx notifications@github.com wrote:

@ugros https://github.com/ugros Why did you close this? Did you find a solution for using reselect?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jumpsuit/jumpstate/issues/41#issuecomment-315360918, or mute the thread https://github.com/notifications/unsubscribe-auth/AFUmCaR5FzZGIqKjwh_Q139Eu90maKJ2ks5sN26hgaJpZM4NbXN- .

matuscongrady commented 7 years ago

The problem was that I had wrong understanding of what reselect selectors are. I thought they are similar to computed properties (from mobx or vue.js). But they are conceptually different. Anyways, if there was a way to implement something similar to computed properties to jumpstate, I would definitely give it a try ;) (even tho I know that's basically impossible without using observables)

tannerlinsley commented 7 years ago

No you are correct, they are computed/derived variables. Because react-redux doesn’t work with observables (and instead uses immutable change detection), reselect helps in computing derived data while still playing nice with react-redux’s internal change detection (which out of the box is basically a shallow object comparison between the previous and next results of mapStateToProps). Use reselect. I promise you will love it after you get used to it.

On Fri, Jul 14, 2017 at 8:45 AM Matúš Čongrády notifications@github.com wrote:

The problem was that I had wrong understanding of what reselect selectors are. I thought they are similar to computed properties (from mobx or vue.js). But they are conceptually different. Anyways, if there was a way to implement something similar to computed properties to jumpstate, I would definitely give it a try ;) (even tho I know that's basically impossible without using observables)

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/jumpsuit/jumpstate/issues/41#issuecomment-315378029, or mute the thread https://github.com/notifications/unsubscribe-auth/AFUmCRt6CfMdey8DqACI2yCpsT-0NeHBks5sN374gaJpZM4NbXN- .