pinqy520 / mobx-persist

persist mobx stores
MIT License
560 stars 62 forks source link

When hydrate, because render before hydrate from localstorage data not reading #83

Open ghost opened 4 years ago

renepardon commented 4 years ago

Have the same problem and trying to figure out how to solve this. I mean it would not be a solution to hydrate all stores on initial page load because this will be a performance killer.

renepardon commented 4 years ago

It's as simple as adding observer() around your functional component or add @observer annotation above your class component. This way the hydrate happens before the component gets rendered. @simayi0322