如何识别React.createClass警告的来源? React v15.6

时间:2017-08-19 21:19:04

标签: reactjs

如何识别导致警告的依赖项?

Warning: Accessing createClass via the main React package is deprecated, and will be removed in React v16.0....

我理解React v16.0带来的变化。我想帮助依赖解决警告,但我不知道谁需要帮助。

的package.json

"dependencies": {
    "autosuggest-highlight": "^3.1.0",
    "material-ui": "next",
    "material-ui-icons": "^1.0.0-alpha.19",
    "nuka-carousel": "^2.2.1",
    "react": "^15.6.1",
    "react-autosuggest": "^9.3.2",
    "react-dom": "^15.6.1",
    "react-helmet": "^5.1.3",
    "react-router-dom": "^4.1.2",
    "react-tap-event-plugin": "^2.0.1",
    "typeface-roboto": "^0.0.35"
  },
  "devDependencies": {
    "enzyme": "^2.9.1",
    "jest-enzyme": "^3.6.1",
    "react-scripts": "^1.0.10",
    "react-test-renderer": "^15.6.1"
  },

1 个答案:

答案 0 :(得分:2)

  1. 您会在控制台中看到警告旁边的行。跳转到chrome-debugger中的那一行,(只需点击它)
  2. 设置一个断点
  3. 重新加载页面,然后您就可以到达
  4. 接下来,在调试器中有堆栈选项卡,打开它,以查看该行的所有函数路径。您应该能够识别有问题的源