mobx-state-tree icon indicating copy to clipboard operation
mobx-state-tree copied to clipboard

NextJS example with Static Optimization

Open kiwicopple opened this issue 5 years ago • 1 comments

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: image

Is there a way to use this mobx-state-tree without using getInitialProps in _app.js`?

Thanks in advance for the help / pointers

kiwicopple avatar Mar 27 '20 11:03 kiwicopple

@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.

chriswolmarans avatar Sep 17 '20 16:09 chriswolmarans

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.

coolsoftwaretyler avatar Jun 27 '23 05:06 coolsoftwaretyler