Skip to content

Instantly share code, notes, and snippets.

@tangyumeng
Created March 7, 2022 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tangyumeng/c241e683c0a7debdef7087a948a11098 to your computer and use it in GitHub Desktop.
Save tangyumeng/c241e683c0a7debdef7087a948a11098 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>
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
const element = <Welcome name="Sara" />;
ReactDOM.render(
element,
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment