React-router TypeError: _this.props.history is undefined

后端 未结 11 2164
旧时难觅i
旧时难觅i 2020-12-15 16:07

I am using react-router with react js and i following their documentation but facing this error

while compiling it shows the error,

TypeError: _this.         


        
11条回答
  •  情深已故
    2020-12-15 16:48

    It seems to me that this.props.history is not defined, because you did not pass the routeProps to the component you want to render.

    Change your routes as follows:

      } />
    

    You can also pass other props to the rendered components using this method.

提交回复
热议问题