-
-
Save muningis/d86a92ba64373389dd9cb99b7b922831 to your computer and use it in GitHub Desktop.
Typed memo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { ComponentProps, ComponentType } from "react"; | |
import { memo } from "react"; | |
export const typedMemo: < | |
Component extends ComponentType<any>, | |
P = ComponentProps<Component> | |
>( | |
c: Component, | |
propsAreEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean | |
) => Component = memo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment