Does react-router support relative links?

后端 未结 6 1244
不思量自难忘°
不思量自难忘° 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:17

    As per the API documentation, links must be absolute:

    The to property of a Link must be a location descriptor, which is either a string (where it's explicitly stated that

    relative paths are not supported

    ), or an object with a pathname property, which is absolute (by its definition), too.

    There is an open issue discussing relative links, which seems to indicate that relative paths may be supported in future.

    Everything said here applies to react-router version 2.x and above.

提交回复
热议问题