Skip to content

Instantly share code, notes, and snippets.

@Keraito
Created November 16, 2021 09:32
Show Gist options
  • Save Keraito/0ea72e68cb08e572ddc224bbe16136eb to your computer and use it in GitHub Desktop.
Save Keraito/0ea72e68cb08e572ddc224bbe16136eb to your computer and use it in GitHub Desktop.
const Component = () => {
const [showImage, setShowImage] = useState(true);
const hideImage = useCallback(() => {
if (showImage) {
setShowImage(false);
}
}, [showImage]);
return (
<Card>
{showImage ? <CardImageCover /> : null}
<CardDescription />
<CardButton onClick={hideImage} />
</Card>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment