serialize
serialize(scope: Scope, { ignore?: Array<Store<any>>; onlyChanges?: boolean }): {[sid: string]: any}
A companion method for fork. Allows to get a serialized value for all the store states within a scope. The main purpose is an application state serialization on the server side during SSR.
Arguments
scope
Scope: a scope object (forked instance)ignore
Optional array of Store to be omitted during serialization (added 20.14.0)onlyChanges
Optional boolean flag to ignore stores which didn't changed in fork (prevent default values from being carried over network)
Returns
An object with store values using sids as a keys
Example
Serialize forked instance state
import {createStore, createDomain, fork, serialize} from 'effector'
const domain = createDomain()
const store = domain.createStore(42)
const scope = fork(domain)
console.log(serialize(scope)) // => {[sid]: 42}