Created
April 7, 2020 08:43
-
-
Save nsivertsen/b7137c217ef078e59d14e198a660fe7e to your computer and use it in GitHub Desktop.
Preact and htm on Deno
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
deno --importmap=import_map.json main.js |
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
{ | |
"imports": { | |
"htm": "https://unpkg.com/[email protected]/dist/htm.module.js", | |
"htm/preact": "https://unpkg.com/[email protected]/preact/index.module.js", | |
"preact": "https://unpkg.com/[email protected]/dist/preact.module.js", | |
"preact-render-to-string": "https://unpkg.com/[email protected]/dist/index.module.js" | |
} | |
} |
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
import { html } from "htm/preact"; | |
import render from "preact-render-to-string"; | |
function App() { | |
return html` | |
<h1>Hello, world!</h1> | |
`; | |
} | |
console.log(render(html`<${App} />`)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment