Giter VIP home page Giter VIP logo

Comments (4)

tomatau avatar tomatau commented on July 24, 2024

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:

  1. Make an array of route config objects which contain the props you give to <Route for that route and a function called preload(){ that returns a promise.
  2. Use this array of routes in the SSR, call any appropriate preload() functions with appropriate arguments.
  3. 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.

believer-ufa avatar believer-ufa commented on July 24, 2024

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:

  1. 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.

  2. 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.

tomatau avatar tomatau commented on July 24, 2024

Are you happy with the solution for data fetching and I can close this issue?

from breko-hub.

believer-ufa avatar believer-ufa commented on July 24, 2024

As you wish) Sure your can close)

from breko-hub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.