[API] Support React.forwardRef component type
See original GitHub issueHello,
- This is a v1.x issue (v0.x is no longer maintained).
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
The ButtonBase
component shouldn’t trigger a warning when passing a value to its component
prop.
Current Behavior
A warning is triggered : Warning: Failed prop type: Invalid prop component supplied to ButtonBase.
Steps to Reproduce (for bugs)
https://codesandbox.io/s/w6ln223vz5
Context
Your Environment
Tech | Version |
---|---|
Material-UI | v1.2.1 |
React | v16.3.2 |
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Forwarding Refs - React
Ref forwarding is an opt-in feature that lets some components take a ref they receive, and pass it further down (in other words,...
Read more >TypeScript + React: Typing Generic forwardRefs - fettblog.eu
Providing types for React.forwardRef is usually pretty straightforward. The types shipped by @types/react have generic type variables that ...
Read more >Supporting React.forwardRef and Beyond | Flow - Medium
In Flow v0.89.0, we're releasing React.AbstractComponent, a new type that we use to model forwardRef and other React components.
Read more >How to use React's forwardRef function | Felix Gerschau
Our task is to forward the ref that the Input component receives to the HTML input element. We do that by wrapping the...
Read more >React/Typescript forwardRef types for an element which ...
While this by no means fixes the problem with React.forwardProps , an alternative would be to work around it and instead utilize an...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@oliviertassinari
I am indeed 😃 Will try to prepare a PR in the next few days!
@NMinhNguyen Thanks for the link. Yes, it’s an opportunity to improve the
component
property type checking. Right now, it’s almost like we have an any. However, some work needs to be done to convert the package into a proptype that will be pruned in production. Are you interested in this task? 😃