Closed tomsdev closed 8 years ago
This component is meant to be higher level than that. There currently isn't any way to integrate into another redux store. It uses redux under the hood, but does not expose any parts of it.
All this component does is inject some parts of its store into an immediate child React component.
I'd be open to breaking the component down into two parts, one that exposes a redux filter and another component that wraps that into a react component.
For the moment, you can always just borrow the reducer tree and the actions to compose your own state tree. There is no automatic way to do this right now, but its certainly possible.
I also hoped the component would act as middleware to compose filters and results (good use of reselect). But when it brings its own store we cannot plug it into existing apps.
Totally see your point. Definitely need to work on the interop story here.
It'd be pretty easy to simply expose the my reducers along with the actions that work with these reducers. Then it's just a matter of creating a store enhancer that can wrap an existing store with the state of the filter.
yeah that or could it also work as middleware?
I'm having a bit of trouble conceptualizing how it would work as a middleware. Could you say a bit more on how you think it would work?
Unfortunately I can also not wrap my head around it. Been with redux only a few days but have built chained filters before in java. It's always nice to be able to plug such things into existing apps. How does a store enhancer work?
I've thought a bit about this, and read a couple repos, notably: https://github.com/rackt/redux/issues/678.
I think it's best to extract and expose reducers, filterActions, an initial state builder and a selector from the component.
I'm leaning towards extracting out all of this logic into a different repo, and have this component rely on it. This should satisfy those that want a lower level solution and to integrate with an existing store.
Here's the example I'm working on: https://github.com/nsmith7989/redux-filter/blob/a9ea81fb446925086a886e6dff99a02883eafbf2/examples/integration/index.js
A working version exists on a9ea81fb4, but I want to think about and clean up the api a bit. It might stay in this component, or it might move into a separate repo.
Cool! Thanks for the effort! Will keep an eye on that. And remember: keep the API surface minimal :)
Hi,
Eagerly waiting for this update (y)...
It's coming. I'm trying to minimize the API surface area. Feedback is welcome. Take a look at https://github.com/nsmith7989/redux-filter/blob/a9ea81fb446925086a886e6dff99a02883eafbf2/examples/integration/index.js for an idea on how it would work.
+1 for integration
Fixed in 2.0
Awesome thanks @nsmith7989 ! :+1: Looking forward to the docs
Hi, I read through the doc and examples but I don't understand how this should be integrated in an app that uses Redux to store the app state. I can see that this could have its own store but normally Redux encourage to have 1 unique store in the app. Any thoughts on this?