keajs / kea-saga

Saga support for kea
https://kea.js.org/effects/saga
MIT License
7 stars 4 forks source link

Allow kea-saga to be run before componentDidMount #10

Closed ghost closed 3 years ago

ghost commented 5 years ago

I'm using Nextjs and using kea for state management. It all works great when routing is made in the browser. Although the plugin is tightly coupled with the componentDidMount lifecycle method from React and therefore I'm not able to take advantage of the getInitialProps new lifecycle event made available by Next in order to fetch data before page load.

I made an example in the nextjs repo in order to add an example that would allow this. But some help would be appreciated.

I started an example here. But some help would be appreciated.