Skip to content

Instantly share code, notes, and snippets.

@Ladvace
Last active March 19, 2022 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ladvace/fb5950d41c5879d554251b6d54b0ae8d to your computer and use it in GitHub Desktop.
Save Ladvace/fb5950d41c5879d554251b6d54b0ae8d to your computer and use it in GitHub Desktop.
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> : null}
<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