【发布时间】:2018-05-17 06:19:33
【问题描述】:
我在控制台中收到有关直接从 React 弃用 Proptypes 的警告。
bundle.js:9748 Warning: Accessing PropTypes via the main React package is deprecated, and will be removed in React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more...
所以,我根据 Facebook github 页面安装了 prop-types,并迁移了代码。
npm install --save prop-types
但警告并没有消失,因为我没有 React 和 React-dom 15.3,所以我升级了它们。之后,我收到错误消息,我的应用程序停止运行:
Error: Cannot find module object-assign
我尝试安装 object-assign 但这并没有消除错误或让应用程序再次运行。
npm install object-assign --save-dev
如何解决此问题并消除 Proptypes 控制台警告?
【问题讨论】:
标签: reactjs react-dom react-proptypes