Skip to content
Michał Mrozowski edited this page Sep 26, 2017 · 10 revisions

In order to be able to fetch data on server side, ARc uses react-router-server. You need to decorate your container with fetchState and call this.props.done.

For example:

import { withDone } from 'react-router-server'

class ResourceListContainer extends React.Component {
  componentWillMount() {
    this.props.readList()
  }

  render() {
    return <ResourceList />
  }
}

const mapDispatchToProps = (dispatch, { done }) => ({
  readList: () => dispatch(resourceListReadRequest({})).then(done, done)
})

export default withDone(connect(null, mapDispatchToProps)(ResourceListContainer))
Clone this wiki locally