Created
January 5, 2023 05:23
-
-
Save modster/d8a35fb2f0c41d2ba9289772bf5ba5cd to your computer and use it in GitHub Desktop.
PREACT | Vanilla JS, Htm, No Build Step, Tiny File Size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<script type="module"> | |
import { h, Component, render } from 'https://unpkg.com/preact?module'; | |
import htm from 'https://unpkg.com/htm?module'; | |
// Initialize htm with Preact | |
const html = htm.bind(h); | |
function App (props) { | |
return html`<h1>Hello ${props.name}!</h1>`; | |
} | |
render(html`<${App} name="World" />`, document.body); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment