Answer the question
In order to leave comments, you need to log in
How to describe the ref that we get from forwardRef in propTypes?
Good afternoon! Please help, I am getting an error
Warning: forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?
Answer the question
In order to leave comments, you need to log in
It's all in the warning itself
Warning: forwardRef rendering functions do not support propTypes or defaultProps.
Either remove propTypes or don't use refs.
const List = (props, ref) => {
return (
<Button
{...props}
ref={ref}
/>
);
}
export default React.memo(React.forwardRef(List));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question