-
Notifications
You must be signed in to change notification settings - Fork 293
Fetching data
Haz edited this page Apr 14, 2017
·
10 revisions
In order to be able to fetch data on server side you need to add static method to your page container. For example:
class ResourceListPageContainer extends React.Component {
static fetchData({ req, res, routes, params, location, store }) {
return new Promise((resolve, reject) => {
store.dispatch(resourceListRequest({ _limit: 15 }, resolve, reject))
})
}
render() {
return <ResourceListPage />
}
}
As you can see this method should return Promise as result.
Special thanks to @kybarg and @protoEvangelion for helping to write this Wiki. Please, feel free to edit/create pages if you think it might be useful (also, see #33)