Initial state: the data passed via res.render is set to be the initial state
Store creation: user provide a function through serverconfig or client option to create a store. This function accepts init state and produces store (basically it is a curry function).
Store binding: react-reduxProvider is used to bind the store to the root element, which can be react-router component if react-router is used or a vanilla react component otherwise.
Store initialization at client side
Redux store create function initStore is passed to react-engine.client via boot options, which is invoked when wrap root component with react-redux Provider. The root component can be either react-router component or a vanilla react component.
Store initialization at server side
Similarly, a create function is needed to initialize the redux store. This function is provided through an optional config.
Sample Kraken config
This is to bring in
redux
/react-redux
support: https://github.com/paypal/react-engine/issues/168res.render
is set to be theinitial state
config
or clientoption
to create a store. This function acceptsinit state
and producesstore
(basically it is a curry function).react-redux
Provider
is used to bind thestore
to the root element, which can bereact-router
component ifreact-router
is used or a vanilla react component otherwise.Store initialization at client side Redux store create function
initStore
is passed toreact-engine.client
via bootoptions
, which is invoked when wrap root component withreact-redux
Provider. The root component can be eitherreact-router
component or a vanillareact
component.Example
Store initialization at server side Similarly, a create function is needed to initialize the
redux
store. This function is provided through an optional config. Sample Kraken config