SSR and Flow Router Explanation


#1

I’m confused over the meaning of server side rendering with respect to Flow Router. Does it just mean that that server code can execute routing commands such as FlowRouter.go() or does it mean that the server is running React components and rendering HTML to the browser?


#2

Server-side rendering (SSR) means fetching all relevant data from your db to render your components/template for a requested route on the server. The resulting HTML then gets send in addition to the rest of your application code to the client. Therefore even a user with JavaScript turned off will see your page instead of a blank one.

This has a few major benefits which you can read more about here: “Tradeoffs in server side and client side rendering”.

FlowRouter does exactly that. It runs your subscriptions on the server and then sends the rendered HTML to the client. There is also an option for defer script loading, which can drastically increase the initial rendering time of your application. As of now FlowRouter (v3) only supports SSR for React.