Open vaynevayne opened 5 days ago
import { observable, action } from 'mobx'
class Polyfill2 {
// antd message, modal, notification 静态方法兼容自定义,兼容 360 等低版本内核
@observable modalConfig = {
type: '',
content: '',
title: '',
}
@action setModalConfig(config) {
this.modalConfig = {...config}
}
// 默认配置
@observable messageConfig = {
type: 'info',
content: '',
duration: 3,
}
@action setMessageConfig(config) {
this.messageConfig = {...config}
}
}
const P = new Polyfill2() //
export default P
I searched and said that new cannot be executed here. Is that the reason? How should I modify it?
I see a mix of Mobx, Zustand (useZustandStore?) and react router. Could you create a clear reproducible issue here with only necessary code? https://codesandbox.io/s/minimal-mobx-react-project-ppgml?file=/index.js
Also I see people encountering the same issue even without Mobx:
can't use mobx in react-router-dom v6 loader function , Is there a problem with my writing?