-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed as not planned
Labels
BASICBasic CheatsheetBasic Cheatsheet
Description
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
):
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:
const Div = memo(forwardRef<HTMLDivElement, Props>(function Div((props, ref) => {
return <div ref={ref}/>;
}));
const Div = memo<Props>(function Div(props => {
return <div/>;
});
Metadata
Metadata
Assignees
Labels
BASICBasic CheatsheetBasic Cheatsheet