rsnext/examples/with-mobx-state-tree/pages/ssg.js
2020-05-18 17:44:18 -04:00

17 lines
539 B
JavaScript

import { getSnapshot } from 'mobx-state-tree'
import SampleComponent from '../components/SampleComponent'
import { initializeStore } from '../store'
export default function Ssg() {
return <SampleComponent title={'SSG Page'} linkTo="/" />
}
// If you build and start the app, the date returned here will have the same
// value for all requests, as this method gets executed at build time.
export function getStaticProps() {
const store = initializeStore()
store.update()
return { props: { initialState: getSnapshot(store) } }
}