Error: Invalid hook call. Hooks can only be called inside of the body of a function component.
Error: Invalid hook call. Hooks can only be called inside of the body of a function component.
场景:sdk中使用antd,export之后前端工程引入报错
原因:react冲突
解决:
"peerDependencies": { "react": ">=16.9.0", "react-dom": ">=16.9.0" }
peerDependencies的目的是提示宿主环境去安装满足插件peerDependencies所指定依赖的包,然后在插件import或者require所依赖的包的时候,永远都是引用宿主环境统一安装的npm包,最终解决插件与所依赖包不一致的问题。