Closed ZhengXinquan closed 2 years ago
在 src 中增加以下代码试试
import { autoFixContext } from 'react-activation';
import jsxRuntime from 'react/jsx-runtime'
import jsxDevRuntime from 'react/jsx-dev-runtime'
autoFixContext(
[jsxRuntime, 'jsx', 'jsxs', 'jsxDEV'],
[jsxDevRuntime, 'jsx', 'jsxs', 'jsxDEV']
)
在 src 中增加以下代码试试
import { autoFixContext } from 'react-activation'; import jsxRuntime from 'react/jsx-runtime' import jsxDevRuntime from 'react/jsx-dev-runtime' autoFixContext( [jsxRuntime, 'jsx', 'jsxs', 'jsxDEV'], [jsxDevRuntime, 'jsx', 'jsxs', 'jsxDEV'] )
测试有效,谢谢🙏
codesandbox 代码重现
描述:
"@umijs/max": "^4.0.17"
使用useMode
报错:TypeError: Cannot read properties of null (reading 'dispatcher')
或TypeError: _useContext is null
操作:
$ mkdir myapp && cd myapp $ yarn create umi ✔ Pick Umi App Template › Ant Design Pro ✔ Pick Npm Client › yarn ✔ Pick Npm Registry › taobao yarn add umi-plugin-keep-alive .umirc.ts 添加插件 plugins: ['umi-plugin-keep-alive'] 修改src/pages/home/index.ts
重现:
codesandbox 代码重现
Originally posted by @ZhengXinquan in https://github.com/alitajs/umi-plugin-keep-alive/issues/76#issuecomment-1235310615