Comments (4)
That's right I don't bake in pre-loading to the boilerplate as the code would be more difficult for a developer trying to understand.
You can add it yourself though with these steps:
- Make an array of route config objects which contain the props you give to
<Route
for that route and a function calledpreload(){
that returns a promise. - Use this array of routes in the SSR, call any appropriate
preload()
functions with appropriate arguments. - If the preload functions fire actions, the data would be loaded into the server side redux store ready for render.
In my experience, server side data loading isn't ideal.
Many times when distributing a website to a large user base, I would rather cache the server response so I can serve the users without hitting my server so often. To put user specific data in the server response, it makes this caching much more difficult. The same applies to serving different languages!
I'd suggest the PRPL pattern.
from breko-hub.
Sorry for long answer - just hard working week.
Thanks for answer) Generally today i searching on best SSR realization in world for React. Thanks for explaining of one of approaches with routes - i'll remember this.
About SSR as isn't ideal approach - unfortunately, many search crawlers working very poor with websites that need JS to get full content of document, especially in async cases. So, i think you know that any request on server makes your app into asynchronous apps.
While i work on one of my projects, we got a lot of problems with seo even with SSR 😂.. For example, you know what google search engine still uses 41 version of chrome engine on their Search bot? If your website working incorrectly on Chrome 41 - you may have problems with seo.
Annother problems with apps without SSR - is async calls problem, as i said above. You can read about it there, for example.
So, today for me, I am almost fully approved on the following conclusions:
-
If you are working on website that need to be found though search enginges and if it fetching data from server on loading - you need SSR. It is necessary, no exceptions.
-
Your website must work only with ES5 javascript code on production. Because even Google doesn't support ES6 on their search engine. I don't think that other engines working better )
from breko-hub.
Are you happy with the solution for data fetching and I can close this issue?
from breko-hub.
As you wish) Sure your can close)
from breko-hub.
Related Issues (20)
- Version 10 of node.js has been released HOT 1
- Windows path bug in css-modules HOT 11
- Semantic UI icon fonts displayed as squares HOT 2
- Mocha doesn't terminate HOT 3
- Serverside redux+socket example HOT 2
- An in-range update of react is breaking the build 🚨 HOT 2
- An in-range update of babel7 is breaking the build 🚨 HOT 2
- How to disable server-side rendering? HOT 5
- How to edit the expected server-side state? HOT 6
- Update react-helmet HOT 1
- An in-range update of eslint is breaking the build 🚨 HOT 5
- Implement review apps HOT 1
- An in-range update of chokidar is breaking the build 🚨
- An in-range update of eslint-plugin-react is breaking the build 🚨
- An in-range update of webpack is breaking the build 🚨
- An in-range update of sinon is breaking the build 🚨
- An in-range update of enzyme-to-json is breaking the build 🚨
- An in-range update of eslint-plugin-react is breaking the build 🚨
- An in-range update of url-loader is breaking the build 🚨
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from breko-hub.