Created
March 19, 2022 12:17
-
-
Save Ladvace/efc5d613421b972d6235b9bff580b4d6 to your computer and use it in GitHub Desktop.
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
import React, { useState } from 'react' | |
export const Component = () => { | |
const [show, setShow] = useState(false) | |
const handleClick = () => { | |
setShow(prev => !prev) | |
} | |
return ( | |
<div> | |
{show && <p>You can see this string</p>} | |
<button onClick={handleClick}>Click Here to toggle</button> | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment