https://github.com/echobind/conditional-hooks
Demo different options for conditional hooks
https://github.com/echobind/conditional-hooks
Last synced: 4 months ago
JSON representation
Demo different options for conditional hooks
- Host: GitHub
- URL: https://github.com/echobind/conditional-hooks
- Owner: echobind
- Created: 2024-05-10T17:41:58.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-10T19:14:17.000Z (about 2 years ago)
- Last Synced: 2025-02-16T12:13:56.139Z (over 1 year ago)
- Language: TypeScript
- Size: 56.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# readme
```ts
import { type UseHook } form "./useHookShared";
import { useHookOld } from "./useHookOld";
import { useHookNew } from "./useHookNew";
type MyComponentProps = {
id: string;
variant?: "default" | "bold",
}
export function MyComponent(props: MyComponentProps) {
const featureFlag = useFeatureFlag();
return featureFlag
?
:
}
type MyComponentImplementationProps = MyComponentProps & {
useHook: UseHook;
}
function MyComponentImplementation({
useHook,
id,
variant = "default"
}: MyComponentImplementationProps) {
const result = useHook();
// ...
};
```