Last active
December 22, 2019 06:31
-
-
Save reciosonny/b3ef000c55ce6b1bb429bf775770fff2 to your computer and use it in GitHub Desktop.
componentHooks.js
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
function App() { | |
const [initialized, setInitialized] = useState(false); | |
const [clicked, setClicked] = useState(false); | |
useEffect(() => { | |
setInitialized(true); | |
}); | |
return ( | |
<div className="App"> | |
{initialized && <h1>Initialized</h1>} | |
<h1 onClick={() => setClicked(true)}>Please click me!</h1> | |
{clicked && <h2>You clicked an object!</h2>} | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment