A Pen by Dan Abramov on CodePen.
Created
March 4, 2022 11:48
-
-
Save Isaiah-Mwinga/6f47600293cc04ebefc2775740cab3a2 to your computer and use it in GitHub Desktop.
Hello World in React
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="root"> | |
<!-- This element's contents will be replaced with your component. --> | |
</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
class Clock extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = {date: new Date()}; | |
} | |
render() { | |
return ( | |
<div> | |
<h1>Hello, world!</h1> | |
<h2>It is {this.state.date.toLocaleTimeString()}.</h2> | |
</div> | |
); | |
} | |
} | |
ReactDOM.render( | |
<Clock />, | |
document.getElementById('root') | |
); |
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
<script src="https://unpkg.com/react/umd/react.development.js"></script> | |
<script src="https://unpkg.com/react-dom/umd/react-dom.development.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Trying learn some React js staffs