-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
Warning when using a custom component in Button #15171
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
Comments
Is this the full error message? There should be link to https://next.material-ui.com/guides/composition/#caveat-with-refs which explains the issue. To be specific you forgot to include the part from https://next.material-ui.com/demos/buttons/#third-party-routing-library about |
Thanks for paying attention to this issue. I will try and provide a sandbox. I was getting more error trying using Edit: sandbox ==> open the console to see the warning |
The first usage is wrong in Material-UI as well as react (without forwardRef). The second one is a typescript issue only with how the We need a test case for forwardRef components in |
@stunaz <Button
component={React.forwardRef<HTMLAnchorElement, Partial<LinkProps>>(
(props, ref) => (
<Link to="/about" {...props} ref={ref as any} />
)
)}
>
with React.ForwardRef (followed in mui docs)
</Button>
|
Nice, Thanks a lot! |
Hi, I am having trouble to type
Button
withLink
fromreact-router
v5, as seen in https://next.material-ui.com/demos/buttons/#third-party-routing-library, maybe some one could add the ts version of this example.tried:
No issue in the editor.
but warning from material-ui
followed by warning from react
using typescrupt:3.3.4000, react:latest, material-ui: next(latest)
Originally posted by @stunaz in #14897 (comment)
The text was updated successfully, but these errors were encountered: