-
function组件中使用antD的Icons会报错违反hooks原则, index.js:1 Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
依赖信息: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
给一个会报错的最小复现看看吧。 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
你给的这个项目没有在
package.json
安装@ant-design/icons
,我安装后在src/pages/edit.tsx
导入可以正常使用:如有问题,需要给一个可以复现报错的最小代码仓库。