Closed FelixLgr closed 2 years ago
Can you post the error message or a code example? We pass through things like className
to the underlying <a>
, so this should work just fine.
In my console, the only error message I get is: Error: Invariant failed
Code example In my App (v6.2.1)
import { Link as LibraryLink } from 'myUxLibrary'
...
return (
<>
<p>It should work</p>
<LibraryLink to={"my/path"}>Link</LibraryLink>
</>
)
In my library (v5.2.0)
import { Link as RouterLink} from 'react-router-dom'
const Link = ({
className
to
children
}: LinkProps): JSX.Element => {
return (
<RouterLink className={`text link ${className}`} to={to}>
{children}
</RouterLink>
)
}
You cannot mix versions of React Router, especially between major versions.
What version of React Router are you using?
v6.2.1
Steps to Reproduce
When we instantiate a Link component of a previous version (in my case a Link of v5.2.0 in an application with v6.2.1), the application crashes. This problem comes from an external library that adds className on a Link component.
Expected Behavior
It should work or at least an explicit error should be written in the console
Actual Behavior
No specific error is found in the console