Hello Team,
As per the documentation I was trying to implement a callback function in the to props of Link Component but i am getting following errors.
_Warning: Failed prop type: Invalid prop to supplied to Link.
in Link (at App.js:57)
in AboutUs (created by Context.Consumer)
in Route (at App.js:29)
in Switch (at App.js:26)
in Router (created by BrowserRouter)
in BrowserRouter (at App.js:25)
in App (at src/index.js:6)_
Everything work perfectly fine if I pass an Object/String/function
https://codesandbox.io/embed/react-routercallback-kikbl
Move to AboutUs page by clicking on AboutUs link
1stand 2nd link will work fine as I have implemented it by passing Object and function as a props but 3rd link(Implemented via callback function) is not working.
Looking for your response
This functionality isn't part of 5.0.1. Unfornunately, the documentation often reflects the current state of development, not the latest released version.
See #6822.
@timdorr Can we rollback the docs on https://reacttraining.com/? See react-router/web/api/Link/to-function I suspect more issues popping up here, and even more confused users who have to consult the issue tracker in general.
thanks @StringEpsilon
Unfortunately, docs fixes are interleaved with updates, so extracting out those changes would be pretty hard to do :(
Just wanted to say I am looking forward to this feature being available on a production version. It's a great improvement and I am glad I looked here after finding a similar issue.
If someone wants to make a documentation PR that adds a note that this is not yet released, that would be appreciated. Something along the lines of:
Note: The "to" as a function API has not yet been released.
Hopefully in the future we'll get a better setup, but short of removing the unreleased API (in which case we would probably need to maintain a branch/PR in order to merge it back in later), the documentation site should make it clear when API doesn't exist yet.
also happy to see this functionality in production!
any idea as to when that might happen?
is there somewhere (PR or open issue) where we can track this feature getting deployed? would like to follow it so i can update as soon as it is released
Really inconvenient to have production documentation reference unreleased features. Do you guys not have a separate docs branch to write unreleased information to? Writing in-development information to production docs is basically playing devil's advocate.
https://github.com/ReactTraining/react-router/pull/6933#issuecomment-535448696
released with v5
i think you forgot to put 'to' or you just left empty
example:
wrong: <Link /> or <Link to />
correct: <Link to="#" />
Most helpful comment
Really inconvenient to have production documentation reference unreleased features. Do you guys not have a separate docs branch to write unreleased information to? Writing in-development information to production docs is basically playing devil's advocate.