erikras / erikras/react-redux-universal-hot-example

Server-side routing not working; globalState's `router` attribute is `null` on server

Open
#748 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

I just cloned a fresh version of this project and added this `console.log` in `App.js`:

``` es6
function fetchData(getState, dispatch) {
const promises = [];
console.log(getState());
...
return Promise.all(promises);
}
```

And on the server, this is what's logged out:

```
[1] { router: null,
[1] auth: { loaded: false },
[1] form: {},
[1] multireducer:
[1] { counter1: { count: 0 },
[1] counter2: { count: 0 },
[1] counter3: { count: 0 } },
[1] info: { loaded: false },
[1] widgets: { loaded: false, editing: {}, saveError: {} } }
```

Why does `router` === `null`? This makes me very sad. I don't know how to fix it, and in my app I need to actually know what the route params are in order to make the correct API query before rendering my components.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.