Last active
May 2, 2024 19:42
-
-
Save maiconrs95/6dc43edbc649e52f9a4f1def54080030 to your computer and use it in GitHub Desktop.
Custom Show React 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
export type Props = { | |
children: React.ReactNode; | |
}; | |
function Show({ | |
when, | |
children, | |
}: Props & { | |
when?: boolean | null; | |
}): JSX.Element | null { | |
// eslint-disable-next-line react/jsx-no-useless-fragment | |
if (when) return <>{children}</>; | |
return null; | |
} | |
export default Show; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment