4 ms·
I am an EE doing some web development on the side. Since a few weeks ago, my stack was mostly Flask (backend) + JQuery (frontend). My web apps were always light
by js_question 8y ago
I am an EE doing some web development on the side. Since a few weeks ago, my stack was mostly Flask (backend) + JQuery (frontend). My web apps were always light on the front end. Then I wanted to experiment with React. So far, I really like the declarative component design but don't like the Single Page App approach. Is there a way to render components on the server for each page individually without having to set up a new react project/web pack build step for each page?
- testb 8y agoThe search term you want is 'react ssr' or 'react server side rendering'
- js_question 8y agoFollowup question. Does it actually make sense to use React and render it server side only to get declarative component design? I can totally see the use case for React for web apps which provide a lot of user interaction on the frontend. But for all other web apps it doesn't seem to make sense as you also have to handle quite a few disadvantages (e.g. SEO unfriendly, user can't copy URL and send to a friend) Am I missing something?
- ohhellno 8y agoNext will manage your URLs and all the SSR does is generate static files for each page with the base data and loader so future requests grab static JSON versions of the pages. There is no need for it to be rendered in the server. You could do it locally and push the resulting files up. URLs will work as you expect them to.
- testb 8y agoThere's a good chance you're not missing something - Lots of people don't like SPA's because the consistency of a normal website isn't there. The best SPA's I've used don't actually feel like SPA's and it's worth mentioning that no one seems to mind Amazon/Github/Youtube not using React/Vue/Angular
- dynamite-ready 8y agoGatsby JS is worth a look. It's basically a framework to create static pages server side, with React's constructs and tools. You can even use data from your Flask based backend directly, to create the static pages.
- andrewmu 8y agoNext.js (https://nextjs.org/ https://nextjs.org/) lets you render pages on the server but have your React app behave normally after that. It's potentially useful for SEO and reducing latency for final page display.
- Wintamute 8y agohttps://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup https://reactjs.org/docs/react-dom-server.html#rendertostati...