Skip to content

Instantly share code, notes, and snippets.

@kiprasmel
Last active November 8, 2022 21:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiprasmel/b327e1d1bbca3b6806cc8549c6bb5bae to your computer and use it in GitHub Desktop.
Save kiprasmel/b327e1d1bbca3b6806cc8549c6bb5bae to your computer and use it in GitHub Desktop.
<!--
- https://preactjs.com/guide/v10/getting-started#no-build-tools-route
- https://preactjs.com/guide/v10/getting-started#alternatives-to-jsx
-->
<script type="module">
import * as preact from 'https://unpkg.com/preact?module';
import htm from 'https://unpkg.com/htm?module';
const h = htm.bind(preact.h);
window.preact = preact;
window.h = h;
function App(props) {
const greet = `hello ${props.name} from preact!`;
return h`
<h1>${greet}</h1>
`;
}
preact.render(h`<${App} name="world" />`, document.body);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment