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