fluce
fluce copied to clipboard
Serialization and deserialization
trafficstars
Perhaps it's a good idea if stores could also provide functions for serialization and deserialization of their state. Something like:
const myStore = {
initial() { /*...*/ },
serialize(storeState) { /* must return string */ },
deserialize(stateAsString) { /* returns state */ },
reducers: { /*...*/ }
}
Then we could implement str = fluce.serialize() / fluce.deserialize(str), which can be used to send current state from server in an isomorphic app.