Last active
April 13, 2024 12:13
-
-
Save temoncher/3f6191501efaa6a2d607a6c08b56e6d0 to your computer and use it in GitHub Desktop.
UseHook component
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
// TODO: make eslint rule only allowing to UseHook inside client components | |
// TODO: make eslint rule not allowing conditions inside useHook | |
export function UseHook<T>(props: { | |
useHook: () => T; | |
children: (hookResult: T) => JSX.Element; | |
}) { | |
const hookResult = props.useHook(); | |
return <>{props.children(hookResult)}</>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment