Skip to content

Instantly share code, notes, and snippets.

@kaineer
Created October 11, 2024 12:37
Show Gist options
  • Save kaineer/111bb74eff90c023120d4029d1688b81 to your computer and use it in GitHub Desktop.
Save kaineer/111bb74eff90c023120d4029d1688b81 to your computer and use it in GitHub Desktop.
interface Props {
condition: boolean;
children: React.ReactNode;
}
export const When = ({ condition, children }: Props) => {
return condition && (<>{ children }</>);
}
export const Unless = ({ condition, children }: Props) => {
return (!condition) && (<>{ children }</>);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment