-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
[Typescript] Button do not accept custom component #16887
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
Please include where |
i also have this problem currently, after upgrading to MUI 4. My Button component comes from "@material-ui/core" and Link is my custom component. Please advise |
Please show the full source. |
sure
TypeScript 3.0.3
|
This should trigger runtime warnings. https://material-ui.com/components/buttons/#ButtonRouter.tsx shows an example how to properly create a component for the runtime and how to type it. |
How is that different from my implementation, except for the "forwardRef" ? Is it generally required or only required if i use react-router? |
There's a comment here from another open but similar issue: |
The solution is not working if you're using the styled-components |
I confirm same issue with Button and styled components in version
I am consuming styled button as below
Button wrapped as Styled component
Error
Here is code sandbox replicating same issue. https://codesandbox.io/s/mui-styled-button-vliel?file=/src/App.tsx |
Current Behavior 😯
Expected Behavior 🤔
It should be able to pass component

Steps to Reproduce 🕹
Steps:
Context 🔦
Your Environment 🌎
The text was updated successfully, but these errors were encountered: