Skip to content

Instantly share code, notes, and snippets.

@marclar
Created September 18, 2015 17:29
Show Gist options
  • Save marclar/4a9bd9cedf15d131013a to your computer and use it in GitHub Desktop.
Save marclar/4a9bd9cedf15d131013a to your computer and use it in GitHub Desktop.
When using aliases, server-side rendering won't work unless you explicitly pass the aliased methods to @connect => dispatch
import * as actions from 'redux/modules/content/page';
import {page} from 'redux/modules/content';
import {load as getPage} from 'redux/modules/content/page';
@connect(
state => ({
page: state.content.page.data,
error: state.content.page.error,
loading: state.content.page.loading
}),
dispatch => ({
...bindActionCreators({
...actions,
getPage //Required for SSR (otherwise, only the method names in `...actions` are available on the server)
}, dispatch)
})
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment