mobx-state-tree
mobx-state-tree copied to clipboard
NextJS example with Static Optimization
Question
- [x] I've checked documentation and searched for existing issues
- [x] I tried the spectrum channel
Hey, I see that you previously created a NextJS example which is working great.
The way it is set up uses getInitialProps in the _app.js file: https://github.com/zeit/next.js/blob/9730be67340d16e2e0c4a936c483326c48be7b1a/examples/with-mobx-state-tree/pages/_app.js#L8
This actually disables Automatic Static Optimization though:

Is there a way to use this mobx-state-tree without using getInitialProps in _app.js`?
Thanks in advance for the help / pointers
@kiwicopple I've made an example using NextJS using React.Context and useMst hook (without using getInitialProps) - https://github.com/chriswolmarans/next-starter
I'm still experimenting and haven't used it in a real app/site so use with caution.
Thanks @kiwicopple and @chriswolmarans!
Looks like this is all sorted out and has been inactive for a while, so I'm gonna close out the issue.