Does anyone here use Redux to store subscriptions or MongoDB data centrally and then disseminate and make changes with it via actions and action creators?
I’ve used Redux quite a bit in regular Express and Node applications and I was able to load MongoDB data on the server and attach the store to the window object via a string of the HTML template that gets sent to client as SSR template.
If I can’t use Redux for subscription data this way, then I really see no point in using Redux at all in Meteor. Reactive containers should do the job just fine.
Does anyone use Redux in their apps to achieve such a functionality? How do you do it? Thanks!
Some are public and required to render pages that are indexed by Google. Hence, these are injected into the HTML payload.
Some are specific to the user. At the top of my app, I use Tracker to subscribe to the collections that are requiring a connected user and I when subscribed I inject the content into redux.
This way I can manage data serialized in the the HTML payload and data from pub sub only using redux.
What is really neat with this approach is that you can use React.PureComponent everywhere. When new data arrives, only the part that requires an update is indeed recalculated in the virtual DOM and apply to the real DOM. It’s super efficient.
That’s the beauty of it. You are leveraging the power of Meteor without crushing your server. You only use reactivity and pub/sub where you really need it.
Plus we have added few other niceties like HTTP 304, high speed caching, … It really makes the difference for my customers.
I can see that in your website above. On a wordpress website, that thing would be slow. Yours is like a super charged platform on steroids or something.
It’s a lot more complex than the traditional meteor data retrieval and binding, but I’m going to work through it and learn. This is really well done. I appreciate your work with this.
I think there is a real use-case here to use Redux with Meteor and without the overhead of running an Apollo server. You’d set this up by adding what I call “reactions”, which are basically autoruns/listeners for Meteor data. Within those reactions, you’d dump the data from Meteor into Redux, and this is the only place where you’d be calling reactive Meteor data. Then, within the app, you just use Redux to look up the data that was piped in through the Meteor autoruns.
hi @jfols, i am actually using meteor-redux-middlewares but i can´t set subscriptionparams when the id_param of the subscriptions change.
would you share your "<subscribe …/>! component code with me. i will so greatful with you.