Closed Amazing-0921 closed 4 months ago
你的React相关依赖是不是配置得不对
{ "private": true, "author": "", "scripts": { "dev": "umi dev", "build": "umi build", "postinstall": "umi setup", "setup": "umi setup", "start": "npm run dev" }, "dependencies": { "@ant-design/pro-components": "^2.6.49", "ace-builds": "^1.26.0", "antd": "^5.12.7", "antd-style": "^3.6.1", "axios": "^1.6.7", "immutability-helper": "^3.1.1", "react": "^18.2.0", "react-ace": "^10.1.0", "react-dom": "^18.2.0", "react-syntax-highlighter": "^15.5.0", "umi": "^4.0.76", "umi-request": "^1.4.0" }, "devDependencies": { "@types/lodash": "^4.14.198", "@types/react": "^18.2.46", "@types/react-dom": "^18.2.18", "@types/react-syntax-highlighter": "^15.5.7", "typescript": "^5.0.3" } }
大师,我该怎么改
@Amazing-0921
删除 node_modules不行,关闭 mfsu 后可以,谢谢大师
那应该是 react 多实例的问题… 你找找umi文档里关于 mfsu 的部分看看,我记得有相关进一步配置介绍的
mfsu: {
shared: {
react: {
singleton: true,
},
},
},
换成 umi 文档里的配置阔以
TypeError: Cannot read properties of null (reading 'useContext')![image](https://github.com/ant-design/antd-style/assets/68459563/d6c5f0de-b125-4a9e-93a3-0d935d7938ba)