Unverified Commit d5daa066 authored by David Golden's avatar David Golden Committed by GitHub

Upgrade with-mobx example (#17921)

upgrade mobx dependencies for with-mobx example and make all necessary code changes as per https://mobx.js.org/migrating-from-4-or-5.html

addresses #17809 
parent 435d4586
......@@ -2,6 +2,6 @@
"presets": ["next/babel"],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }]
["@babel/plugin-proposal-class-properties", { "loose": false }]
]
}
......@@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"mobx": "^5.15.4",
"mobx-react": "^6.2.2",
"mobx": "^6.0.1",
"mobx-react": "^7.0.0",
"next": "latest",
"react": "^16.13.1",
"react-dom": "^16.13.1"
......
import { action, observable, computed, runInAction } from 'mobx'
import { useStaticRendering } from 'mobx-react'
import { action, observable, computed, runInAction, makeObservable } from 'mobx'
import { enableStaticRendering } from 'mobx-react'
import { useMemo } from 'react'
// eslint-disable-next-line react-hooks/rules-of-hooks
useStaticRendering(typeof window === 'undefined')
enableStaticRendering(typeof window === 'undefined')
let store
class Store {
constructor() {
makeObservable(this)
}
@observable lastUpdate = 0
@observable light = false
......
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