React-redux-universal-hot-example: Use fetchData on server and fetchDataDeferred on client

Created on 9 Mar 2016  路  1Comment  路  Source: erikras/react-redux-universal-hot-example

Hey guys,
I'm building an app which needs to have good SEO, so I load all my data in fetchData calls. The problem is that it makes the client experience very slow. When I navigate to a route that needs to load new data (from an API), there is a waiting time of between 0.3s and 1s before the new page gets displayed at all. That's a time where nothing happens to show the user that his action triggered something. It feels like nothing happens.

What I'm trying to do instead is to render the next component immediatly with a spinner while it takes time to load data. Basically the same behaviour as fetchDataDeferred but only when I'm the client experience.

Does anybody have an idea on how to do this?

Most helpful comment

What about setting something like window.__CLIENT__ = true; in client.js and then in your container have:

@asyncConnect([{
  deferred: !!__CLIENT__,
  ...
}])

I'm not sure that will work as-is but you get the idea, right?

>All comments

What about setting something like window.__CLIENT__ = true; in client.js and then in your container have:

@asyncConnect([{
  deferred: !!__CLIENT__,
  ...
}])

I'm not sure that will work as-is but you get the idea, right?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

massimopibiri picture massimopibiri  路  5Comments

donpinkus picture donpinkus  路  5Comments

c089 picture c089  路  5Comments

jorgehmv picture jorgehmv  路  3Comments

bdsabian picture bdsabian  路  6Comments