Closed
Description
I'm going to make the following API changes:
Shared Stores
-
We allow defining the redux store in the controller, before the view renders. We can use the same api:
redux_store(store_name, props = {})
-
We provide a new helper
redux_store_hydration_data
which takes no parameters. This client renders the redux store registered at the controller level. Put at end of your layout so that browser is not blocked reading your props for client side hydration. I.e., the browser can render your server rendered React before trying to parse props. Best to place this on your main Rails layout. This generates nothing if there's no stores being initialized by the controller. Note, while multiple stores would be rendered, a best practice is to have only one store.redux_store_hydration_data
-
Allow calling getStore to return undefined
# Add optional parameter to getStore to not throw if store is not found ReactOnRails.getStore(storeName, required = true);