Unexpected token < error in react router component

后端 未结 5 1827
小鲜肉
小鲜肉 2020-11-27 15:17

I\'m trying to write router component for my react app. I\'m create new react class and define some routes in componentDidMount method. This is full method

c         


        
5条回答
  •  有刺的猬
    2020-11-27 15:21

    Unexpected token "<" in this case comes from a nested path. Components that are in the nested are late to read.

    This is the option that you can do:

    1. Check this https://reactrouter.com/web/example/nesting for documentation
    2. Make the nested path some switch logic with default return. In this component. Take a look at the documentation.

    1. In my case, i'm not use that, i make the single path and i send the parameter with a reducer.

提交回复
热议问题