Invariant Violation: You should not use outside a

后端 未结 10 1498
没有蜡笔的小新
没有蜡笔的小新 2021-02-01 00:30

I have a problem that I don\'t know how to solve, I get this error when running npm test

Invariant Violation: You should not use

10条回答
  •  自闭症患者
    2021-02-01 01:05

    Make sure to have correct imports in all nested components. You might get that error if one of them imports Switch from react-router instead of react-router-dom. Keeping everything consistent with 'react-router-dom' (that reexports react-router components anyway). Checked with:

    "react-router": "^5.2.0",
    "react-router-dom": "^5.2.0",
    

提交回复
热议问题