Closed kalbert312 closed 5 years ago
I got around this with
const Button = (props, ref) => {
//...
}
const forwarding = React.forwardRef(Button);
Button.propTypes = {
//...
};
export default forwarding;
forwardRef/memo don't support propTypes since a new object with a render method is returned.
Great catch 👍 It's a priority stuff for me, will work on a fix.
Published babel-plugin-transform-react-handled-props@1.1.0
, please check and provide feedback 🐱
It works! Thanks.
Wrapping a function component with
React.forwardRef
orReact.memo
causes it to get ignored.Example:
Can also be chained, e.g
React.memo(React.forwardRef(() => ...))