I have a question, suppose there are two scenarios before login and after login:
Before login
Website will be SEO with next js or some other way. And has few pages like blog, blog details, about, contact, and products etc.
After login
Normal feature like post, post details with CRA(Create React App) setup.
My question is how do we setup the project with before login in SSR and after login. I don’t want SSR after login because there are lots of load on server for each features and functionality.
Is there any solution?
I have few article on isomorphic like https://hackernoon.com/get-an-isomorphic-web-app-up-and-running-in-5-minutes-72da028c15dd
example starter kit project: https://github.com/xiaoyunyang/isomorphic-router-demo
Can we create both SSR and Create react app within one project setup?
2
Answers
Yes we can, there are some articles about that topic:
Upgrading a create-react-app project to a SSR + code splitting setup
Server-side rendering with create-react-app, code-splitting, preloaded data, React Router, Helmet, Redux, and Thunk
If you’re using an express server you can use ssr-for-bots middleware to apply ssr to certain routes only.
That way the paths before login will be SSR, and paths after login (let’s say they all start with /app) will be excluded