-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaking change between version 5.0.1 and 5.1.0 #6934
Comments
👋 @kennethlarkin, we use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. For usage questions, please use Stack Overflow or Reactiflux where there are a lot more people ready to help you out. |
Tim, thanks for replying. Not looking for Support I am looking to report a bug. If the code was working on major version 5 it should continue to work on all major version 5 sub versions. I have included steps to reproduce the bug above and the expected behavior. i have looked at the release notes and this should not have been affected. |
Those steps aren't sufficient, as they don't include detailed enough data. Can you reproduce this on codesandbox.io? At the very least, can you produce a stacktrace that isn't minimized. |
There is already an example on there: Change the react-router-dom version to latest and it breaks |
Seems to affect only react <= 16.2.x With RR 5.1 and React 16.3, it works. Root cause is most likely Given that we still "support" react 15 (and 16.0 - 16.2), this sure is a breakage. |
So, a couple of things there:
|
I'm confused as to how the function Link(props) {
// ...
}
export { Link } And after the patch we have: let forwardRef = C => C;
const Link = forwardRef((props, ref) => {
// ...
})
export { Link } All React 15 sees is a function that takes some props. Is this line the one that causes the breakage?? |
Yep, that's what's doing it. |
Ah, I see. The |
If we can't use forwardRef, we shouldn't ever pass a ref to a functional component. Use innerRef workaround instead. Fixes #6934
This was fixed and released in 5.1.1 https://github.com/ReactTraining/react-router/releases/tag/v5.1.1 |
Version
5.1.0
Test Case
upgrading a site between 5.0.1 and 5.1.0 breaks the site.
Steps to reproduce
add a <link> inside a <browserRouter>
let BrowserRouter = ReactRouterDOM.BrowserRouter;
let Link = ReactRouterDOM.Link;
adding a to= doesnt make a difference
return (
<BrowserRouter>
<Link className="nav-link" >Home</Link>
Expected Behavior
link rendered
Actual Behavior
backend.js:6 Warning: Stateless function components cannot be given refs. Attempts to access this ref will fail.
Check the render method of
e
.in Unknown (created by e)
in e
in Unknown (created by AppLayout)
in t (created by t)
in t (created by t)
in t (created by AppLayout)
in AppLayout
The text was updated successfully, but these errors were encountered: