Open arush0311 opened 7 years ago
Would this enable server-side fetching of external APIs? It would be great if we could serve pre-rendered pages instead of making the client fetch more data after it loads React.
I dont think redux has much to do with server side rendering aside from providing store. Do we want it for seo? I think node (or phantom js) server would be needed to do anything of the sorts.
We are using a node server. I haven't dug into the SEO situation with things like Projects and Events, but it's simply better UX to send the user all the information they need to render the page in one response, rather than forcing another roundtrip. I haven't dug into Redux/Flux/etc. but I believe they can transfer state from the server to the client, which means all the information could be made available in the initial payload.
We are using a node server
What do we use it for?
it's simply better UX to send the user all the information they need to render the page in one response, rather than forcing another roundtrip
Well its a problem of first rendering. And yes, during first render all the response and initial state is calculated on a node server and then sent to client
@arush0311, i think what @alanmoo wants is described in this article https://hackernoon.com/reconciling-djangos-mvc-templates-with-react-components-3aa986cf510a
Not quite. More like http://redux.js.org/docs/recipes/ServerRendering.html
Well yeah! Redux can store the first render state and pass it to client. Where do we to our node related stuff?
There's not much to it right now; server.js
is what node is running on production.
Ah. I will look into it :)
This is an interesting approach https://aakashgoel.com/server-side-rendering-with-a-django-webserver-57c7356effd1 without changing the django backend. @alanmoo ^
will also help with https://github.com/mozilla/science.mozilla.org/issues/597
I think it will be lot better for our state be handled by some state management engine (Redux , mobx etc). It will also help with https://github.com/mozilla/science.mozilla.org/issues/604 and https://github.com/mozilla/science.mozilla.org/issues/135