React this.props.params undefined

后端 未结 6 1279
名媛妹妹
名媛妹妹 2021-02-07 03:15

I have problem passing id to my page with product, I tried everything and search answer but it still doesn\'t work.

Here is my index.js:

impor         


        
6条回答
  •  無奈伤痛
    2021-02-07 03:57

    For me I was using the render method and finding that this.props.match was undefined in rendered components. This was the solution for me, you have to pass in props.

    this.props.match will be undefined for:

     }/>
    

    Do this instead:

     }/>
    

    https://reacttraining.com/react-router/web/api/Route/render-func

提交回复
热议问题