Skip to content

Instantly share code, notes, and snippets.

@Ladvace
Created March 19, 2022 12:17
Show Gist options
  • Save Ladvace/efc5d613421b972d6235b9bff580b4d6 to your computer and use it in GitHub Desktop.
Save Ladvace/efc5d613421b972d6235b9bff580b4d6 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>}
<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