React-router: [Link] to property as function does not work in react-router-dom

Created on 10 Jul 2019  路  4Comments  路  Source: ReactTraining/react-router

Version

5.0.1

Test Case

https://codesandbox.io/s/a-simple-react-router-v4tutorial-bnwby

Steps to reproduce

I've set components/Header.js second link as function. Click on the second link in the header ("Roster")

Expected Behavior

It should go to the route.

Actual Behavior

It does not go to the route with an error in the console.
Warning: Failed prop type: Invalid prop `to` supplied to `Link`.
The error is shown even when the page is loaded.

Most helpful comment

I also discovered this feature in the docs, and it is a really nice feature. Any chance that it is released early?

All 4 comments

OK. I was checking the repo, but I didn't realized this commit is not in the release yet.

Yes, sorry! Currently the way that this repo works is that PRs get merged into master; we don't have a dev-type branch for unreleased code. This means that when the documentation site gets built, it can include unreleased API. This isn't good and hopefully a process gets worked out to prevent this sort of issue.

When do you plan to released that?

Also I find it convenient to use that function to put in a side-effect of scrolling to the top. What do you think of that usage? @pshrmn

I also discovered this feature in the docs, and it is a really nice feature. Any chance that it is released early?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexyaseen picture alexyaseen  路  3Comments

ryansobol picture ryansobol  路  3Comments

winkler1 picture winkler1  路  3Comments

Waquo picture Waquo  路  3Comments

wzup picture wzup  路  3Comments