Accessing PropTypes via the main React package is deprecated

1.Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.

2.Warning: RouterContext: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.



“import { Button } from 'antd';”这个语法导致的1和2的问题是吗


你这个只是warning,并不影响开发的,其实你不用管的。

至于出现warning的原因,里面已经说的很清楚了:

PropTypes已经不建议直接从react中获取了,而是从prop-types组件中获取

createClass也会在react 16中去除,所以不建议使用。

可能是因为你引入的某些组件还在使用这些东西吧,不过只是warning并不影响开发的。

你可能感兴趣的:(Accessing PropTypes via the main React package is deprecated)