Skip to content

Instantly share code, notes, and snippets.

@theory-of-soul
Created August 25, 2022 07:41
Show Gist options
  • Save theory-of-soul/0e100711820f291b3497229264e91f6d to your computer and use it in GitHub Desktop.
Save theory-of-soul/0e100711820f291b3497229264e91f6d to your computer and use it in GitHub Desktop.
memoWithGeneric
type PropsType<T> = {
prop: T
};
type memoWithGeneric = <T>(props: PropsType<T>) => JSX.Element;
const Component = <T,>(props: PropsType<T>) => { ... }
export const MyComponent = React.memo(Component) as memoWithGeneric;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment