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

How can I load fetchDataDeferred based on route values?

Open
#954 3 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

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

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.