Skip to content

Instantly share code, notes, and snippets.

@ricardocanelas
Created August 29, 2020 20:36
Show Gist options
  • Save ricardocanelas/9a856ee733cfcfe89dbee17a4a4b580d to your computer and use it in GitHub Desktop.
Save ricardocanelas/9a856ee733cfcfe89dbee17a4a4b580d to your computer and use it in GitHub Desktop.
Preact Example
<!DOCTYPE html>
<html>
<head>
<title>Preact</title>
</head>
<body>
<script type="module">
import {
html,
render,
} from "https://unpkg.com/htm/preact/index.mjs?module";
function MyComponent(props) {
return html`<div>My name is ${props.name}</div>`;
}
const App = html`<div>
<${MyComponent} name="John Doe" />
</div>`;
render(App, document.body);
</script>
</body>
</html>
@ricardocanelas
Copy link
Author

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