A project created by Hatem Hosny on LiveCodes.
Last active
September 3, 2022 09:31
-
-
Save hatemhosny/f01deb828a42f363502fbae7964d48e9 to your computer and use it in GitHub Desktop.
React demo
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
<div id="app">Loading...</div> |
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
import React, { useState } from "react"; | |
import ReactDOM from "react-dom"; | |
function App(props) { | |
const [count, setCount] = useState(0); | |
return ( | |
<div class="container"> | |
<h1>Hello, {props.name}!</h1> | |
<img src="https://livecodes.io/livecodes/assets/templates/react.svg" className="logo" /> | |
<p>You clicked {count} times.</p> | |
<button onClick={() => setCount(count + 1)}>Click me</button> | |
</div> | |
); | |
} | |
ReactDOM.render(<App name="React" />, document.querySelector("#app")); |
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
.container, | |
.container button { | |
text-align: center; | |
font: 1em sans-serif; | |
} | |
.logo { | |
width: 150px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment