Created
July 3, 2020 15:42
-
-
Save jamiejohnsonkc/d00dea1ca7979d5268d23a24cc2ea3fb to your computer and use it in GitHub Desktop.
hide div using react hooks useState button
This file contains hidden or 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
| /** @jsx jsx */ | |
| import { jsx, Container } from "theme-ui" | |
| import React, { useState } from "react" | |
| function Demo2() { | |
| const [isVisible, setIsVisible] = useState(true) | |
| return ( | |
| <div style={{ display: isVisible ? "block" : "none" }}> | |
| <p>This is the visibilityi test div</p> | |
| <button onClick={() => setIsVisible(false)}>Click me</button> | |
| </div> | |
| ) | |
| } | |
| export default Demo2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment