Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function but got: object

前端 未结 30 1057
孤城傲影
孤城傲影 2020-11-22 06:53

I am getting this error:

Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/funct

30条回答
  •  囚心锁ツ
    2020-11-22 07:26

    If you get this error, it might be because you're importing link using

    import { Link } from 'react-router'

    instead, it might be better to use

    import { Link } from 'react-router-dom'
                          ^--------------^
    

    I believe this is a requirement for the react router version 4

提交回复
热议问题