-
-
Notifications
You must be signed in to change notification settings - Fork 87
addCallback to execute a function after state change. #29
Comments
Are you talking about for SSR? Can you elaborate on how you want state to persist and how you would want it to rehydrate? |
I'm changing this to just a request for state persistence, as rehydration between server and client exists as issue #9. I would still need more information to tackle this request, though. I'm not sure what specifically you are requesting in relation to a React Native application. |
Hi! sorry for the delay. My request was not about server side rendering, it was about persistence and (after cold start) retrieving that data from storage (the term rehydration means that in redux persistence - https://github.com/rt2zz/redux-persist). It just handles the 'asynchronicity' of a cold start to initialize the store with the latest bunch of data, IIUC |
I understand. You want persistence of state between application launches. I think "afterware" support may allow for this. Something like useAfterware(function(global) {
persistentStorage.set('global', JSON.stringify(global));
});
// The above function executes with the new global state whenever setGlobal occurs. If something like this sounds good to you, I'll mark it as TODO. I want to make sure it matches your use case. |
Yes, I think that would cover the lifecycle of any Used in conjunction with componentDidMount (pseudo code): //based in the example from reactn/Examples/Class Components
export default class MyView extends React.Component {
...
componentDidMount() {
persistentStorage.get('global', (value)=>{
this.setGlobal(
JSON.parse(value)
)
})
}
render() {
...
} Thanks for your work. |
Was this implemented? Is there a way to hook into setGlobal with the current release? |
This has not been done yet. I have been out for various reasons the past month and have returned to my development life as of today. |
I'd just like to state that I have this existing in my local repository (using the name |
I have released I added some unit tests and manual app testing to try to insure there were no breaking changes, but this version included a major change to some internal workings. I would love some community feedback on if any errors are discovered. Thank you for your patience. I'm sorry about the long delay. I have been unable to contribute for the past month, but I'm hoping to begin knocking out a lot of ReactN's open issues now. |
Hi there,
I'm wondering If there's a chance to get some persistence & rehydration. I'm considering to use it for a new react-native app and not having such would be a stopper
Thanks
The text was updated successfully, but these errors were encountered: