Skip to content

Instantly share code, notes, and snippets.

@Isaiah-Mwinga
Created March 4, 2022 11:48
Show Gist options
  • Save Isaiah-Mwinga/6f47600293cc04ebefc2775740cab3a2 to your computer and use it in GitHub Desktop.
Save Isaiah-Mwinga/6f47600293cc04ebefc2775740cab3a2 to your computer and use it in GitHub Desktop.
Hello World in React
<div id="root">
<!-- This element's contents will be replaced with your component. -->
</div>
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')
);
<script src="https://unpkg.com/react/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom/umd/react-dom.development.js"></script>
@Isaiah-Mwinga
Copy link
Author

Trying learn some React js staffs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment