控制台报错信息:
MenuItem should not leave undefined `key`
React does not recognize the `warnKey` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `warnkey` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
原因:
1. antd 的 4.16.0 版本有这个问题,后续版本已解决,升级到最新即可。
2. 使用了 pro-components (antd-pro) 的也可能报这个错误,也要跟随antd升级到最新版本
解决方式:升级antd版本
npm i antd@4.17.0 --save
如果你的项目是yarn启动的,在安装了4.17.0之后,就
rm -rf node_modules/
yarn install
这样启动项目的时候就可以啦