createPage([...connectArgs])(Page, [reducers])
Configures and connects to Redux store, loads reducers dynamically, handles client side URL redirection, and makes cookie, default locale, locale, and site locales available as Page
props and in the getInitialProps
lifecycle method.
It will also make them available to the component hierarchy below, through the following method calls:
Cookie through
withCookies
calls, imported fromreact-cookie
.Default locale, locale, and site locales through
withLocale
calls, imported fromsoya-next/i18n
.
Arguments
[
...connectArgs
] (Connect Arguments)Page
(ReactComponent): Page component to be enhanced.[
reducers
] (Object): An object of reducers which will be loaded dynamically with the given name.Note: Make sure each reducers has unique name within your application reducers.
Returns
(ReactComponent): An enhanced Page component class.
Examples
Accessing and mutating cookie
Accessing default locale, locale, and site locales
Dispatching an action and retrieving redux state
Last updated