hydrate
A companion method for serialize. Hydrates provided values into corresponding stores within a provided domain or scope. The main purpose is an application state hydration on the client side after SSR.
Arguments
domainOrScope
: domain or scope which will be filled with givenvalues
values
: a mapping from store sids to store values or a Map where keys are store objects and values contains initial store value
caution
You need to make sure, that the store is created beforehand, otherwise, the hydration might fail. This could be the case, if you store initalization / hydration scripts separate from stores' creation.
#
ExamplePopulate store with a predefined value