Closed jmatsushita closed 7 years ago
To clarify I want to check if pouch has local data, if not check if a remote couch has data and set my initial state that way.
I'm using https://github.com/pgte/pouch-redux-middleware but I'm wondering if https://github.com/medihack/redux-pouchdb-plus would be a better fit, or maybe I should use something like https://github.com/KELiON/redux-async-initial-state ?
Hello,
the idea is pretty simple, you should be able to provide initial state in boilerplate.js
file located in the skeleton repo.
So instead of
const store = storeFactory(updater);
You'd have something like:
const store = storeFactory(updater, window.reduxState);
Where window.reduxState
would just be serialized JSON provided in initial rendering of the HTML page.
You can look into our official boilerplate we are doing it exactly this way.
I do not think that redux-async-initial-state
would help you anyhow since you want to initially load the state synchronously.
Was my explanation any helpful?
Hi there,
What's the pattern in redux-elm to hydrate/rehydrate which if I understand correctly is the redux terminology for providing initial state from the server or a store (in my case Pouch).
I'm not sure if I can do this in the boilerplate or if it should go in the Updaters and if so how?
Cheers,
Jun