ssrwpo / ssr

SSR - Router with SSR for Node & Meteor
https://ssrwpo.github.io/ssr/
MIT License
93 stars 16 forks source link

Reducer documentation link is broken #40

Closed julian-rare closed 7 years ago

julian-rare commented 7 years ago

In the docs, the link https://github.com/ssrwpo/ssr/blob/master/shared/reducers/utils is broken.

Trying to get my head around ssrwpo reducers, I'm used to use functions as reducers with redux, but on your example is just a key value set, how to migrate from a function to a key value? or do you have an example that just uses a normal function as the reducer?

PEM-- commented 7 years ago

Hi @julian-rare. Indeed the demo and the package codes have been restructured. Meteor was embedding the demo code in the package leading to issues on deployments for one of our users. Hence, some links are down. Still, the package and the demo code should be easily accessible as we have sticked as much as possible to Meteor's guide.

Concerning your question, in your store, you should be able to use any kind of reducers. Bare in mind that what you provide to the server part must not be blocking and should run without state modifications that would require multiple redraw. Indeed, the server only render once. Note also that you can create asymetric reducers: reducers that behave differently on the client and on the server. This allows you to inject data in your HTML payload created by your server and have a more advanced strategy on your clients, like leveraging redux-persist, for instance.

By the way, you should ask these questions on Meteor's forum. Sharing best practices would help other users 😉