Last active
June 23, 2021 05:32
-
-
Save teyfix/8f2d5e2505c451fe9ca0ac6b02c65fee to your computer and use it in GitHub Desktop.
react - use state
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
const HelloWorld = () => { | |
const [show, setShow] = useState(false); | |
return ( | |
<section> | |
<h1>Merhaba dünya!</h1> | |
{show ? <p>Günaydın.</p> : null} | |
<button onClick={() => setShow(!show)}>Merhaba!</button> | |
</section> | |
); | |
}; | |
ReactDOM.render(HelloWorld, document.getElementById('root')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment