erikras / erikras/react-redux-universal-hot-example
How can I load fetchDataDeferred based on route values?
Open
- Dominant language
- JavaScript
- Stars
- 12.1k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
Say I have a route "/projects/:id"
I would like to load data for this project, and think it should be done in "fetchDataDeferred" to support server side rendering
But how can I use the parameter form the route? (:id)
### Sample code
``` javascript
function fetchDataDeferred(getState, dispatch) {
return dispatch(loadProject());
}
}
@connectData(null, fetchDataDeferred)
@connect(
(state) => ({
project: state.projects.currentProject,
}),
{initialize, ...projectActions}
)
export default class Project extends Component {
....
}
```
Contributor guide
Assessment
This issue has not been assessed yet.