Created
October 11, 2024 12:37
-
-
Save kaineer/111bb74eff90c023120d4029d1688b81 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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