Does react-router support relative links?

后端 未结 6 1361
不思量自难忘°
不思量自难忘° 2020-12-29 04:40

I\'m on this url:

/path1/path2

Then:


With this code the address in the

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-29 05:20

    Also you can use this.props.match.url because the match object has the url Object which is the currently loaded path (the page you're currently on).

    In the end you can chain /path1/path2 and build a dynamic relative path like this this.props.match.url + /path1/path2

    Example:

    Path name

提交回复
热议问题