Skip to content

Instantly share code, notes, and snippets.

@wallace-sf
Last active February 20, 2022 22:28
Show Gist options
  • Save wallace-sf/1a8f88d57a5db48226819ab7335002a4 to your computer and use it in GitHub Desktop.
Save wallace-sf/1a8f88d57a5db48226819ab7335002a4 to your computer and use it in GitHub Desktop.
Currying component with Typescript
export type CurryMyComponentProps = (
component: React.FC<MyComponentProps>
) => (
props: React.PropsWithChildren<MyComponentProps>
) => React.ReactElement | null;
export const curryMyComponent: CurryMyComponentProps = (component) => (props) => {
/*
Other stuff here...
*/
return component(props);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment