Unverified Commit 9fc58f88 authored by Thang Vu's avatar Thang Vu Committed by GitHub

fix: hydration warning in with-mobx-state-tree-typescript example (#27339)



## Bug

- [x] Related issues linked using `fixes #number` fixes https://github.com/vercel/next.js/issues/27290
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes
parent e0ca6de8
...@@ -11,7 +11,7 @@ interface IOwnProps { ...@@ -11,7 +11,7 @@ interface IOwnProps {
} }
const SampleComponent: React.FC<IOwnProps> = observer((props) => { const SampleComponent: React.FC<IOwnProps> = observer((props) => {
const { lastUpdate, light, start, stop } = useStore('') const { lastUpdate, light, start, stop } = useStore(props.store)
useEffect(() => { useEffect(() => {
start() start()
......
/// <reference types="next" /> /// <reference types="next" />
/// <reference types="next/types/global" /> /// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />
...@@ -2,8 +2,8 @@ import { getSnapshot } from 'mobx-state-tree' ...@@ -2,8 +2,8 @@ import { getSnapshot } from 'mobx-state-tree'
import SampleComponent from '../components/SampleComponent' import SampleComponent from '../components/SampleComponent'
import { initializeStore } from '../store' import { initializeStore } from '../store'
export default function Ssg() { export default function Ssg({ initialState }) {
return <SampleComponent title={'SSG Page'} linkTo="/" /> return <SampleComponent title={'SSG Page'} linkTo="/" store={initialState} />
} }
// If you build and start the app, the date returned here will have the same // If you build and start the app, the date returned here will have the same
......
...@@ -2,8 +2,8 @@ import { getSnapshot } from 'mobx-state-tree' ...@@ -2,8 +2,8 @@ import { getSnapshot } from 'mobx-state-tree'
import SampleComponent from '../components/SampleComponent' import SampleComponent from '../components/SampleComponent'
import { initializeStore } from '../store' import { initializeStore } from '../store'
export default function Ssr() { export default function Ssr({ initialState }) {
return <SampleComponent title={'SSR Page'} linkTo="/" /> return <SampleComponent title={'SSR Page'} linkTo="/" store={initialState} />
} }
// The date returned here will be different for every request that hits the page, // The date returned here will be different for every request that hits the page,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment