We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
memo
What cheatsheet is this about? (if applicable)
Basic cheatsheet
What's your issue or idea?
Some docs on memo would be useful.
For example it took me a while to understand that such a combination of memo and forwardRef is wrong (the resulting type would not include ref):
forwardRef
ref
const Div = memo<Props>(forwardRef<HTMLDivElement, Props>(function Div(props, ref) => { return <div ref={ref}/>; }));
The correct way is to omit <Props> on memo if there is forwardRef inside it, so my suggestions are:
<Props>
const Div = memo(forwardRef<HTMLDivElement, Props>(function Div((props, ref) => { return <div ref={ref}/>; }));
const Div = memo<Props>(function Div(props => { return <div/>; });
The text was updated successfully, but these errors were encountered:
Sounds like it could be useful. Feel free to contribute!
Sorry, something went wrong.
No branches or pull requests
What cheatsheet is this about? (if applicable)
Basic cheatsheet
What's your issue or idea?
Some docs on
memo
would be useful.For example it took me a while to understand that such a combination of
memo
andforwardRef
is wrong (the resulting type would not includeref
):The correct way is to omit
<Props>
on memo if there isforwardRef
inside it, so my suggestions are:The text was updated successfully, but these errors were encountered: