Cannot read property ‘params’ of undefined (React Router 4)

后端 未结 6 760
甜味超标
甜味超标 2020-12-29 04:49

I have a route set up to render a component:



        
6条回答
  •  醉话见心
    2020-12-29 05:29

    Because with render you are not passing the default props passed by the router into component, like match, history etc.

    When you write this:

    
    

    It means no props value in PageStart component.

    Write it like this:

    render = {props =>  } />
    

    Now {...props} will pass all the value into PageStart component.

提交回复
热议问题