Cannot read property 'isRequired' of null有什么方法能快速定位到这种错误吗

Uncaught TypeError: Cannot read property 'isRequired' of null

当react+webpack打包出来后,报上面的错,有什么办法能快速定位到这种错误的位置么,特别是在东西多了,就不好找了
阅读 3.4k
3 个回答
  1. 全局查找看哪用到了。估计是哪里数据没有做判空的判断。

  2. 组件做Prop Validation

  3. 在开发时就应该排除这种错误,都打包编译完了在哪找

eslint,并加入react插件。

推荐问题