Skip to content

Instantly share code, notes, and snippets.

@Huweicai
Created April 25, 2022 17:04
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 Huweicai/ec7019ce2ec577d8aef60edd1eb03a86 to your computer and use it in GitHub Desktop.
Save Huweicai/ec7019ce2ec577d8aef60edd1eb03a86 to your computer and use it in GitHub Desktop.
PGEjdG
<div id="root">
<!-- This div's content will be managed by React. -->
</div>
function formatName(user) {
return user.firstName + ' ' + user.lastName;
}
const user = {
firstName: 'Harper',
lastName: 'Perez'
};
const element = (
<h1>
Hello, {formatName(user)}!
</h1>
);
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