Skip to content

Instantly share code, notes, and snippets.

@reoseah
Created February 6, 2024 11:33
Show Gist options
  • Save reoseah/a56f116bea4136cac89bec8eba719865 to your computer and use it in GitHub Desktop.
Save reoseah/a56f116bea4136cac89bec8eba719865 to your computer and use it in GitHub Desktop.
Solid.JS using Lit templates without needing build step and Node
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Solid.JS Lit templates test</title>
<script type="module">
import { createSignal } from 'https://cdn.jsdelivr.net/npm/solid-js@1.8.12/+esm'
import { render } from 'https://cdn.jsdelivr.net/npm/solid-js@1.8.12/web/+esm'
import html from 'https://cdn.jsdelivr.net/npm/solid-js@1.8.12/html/+esm'
const App = () => {
const [count, setCount] = createSignal(0);
return () => html`
<div>
<h1 onclick=${(e) => setCount(count() + 1)}>I was clicked ${count()} times</h1>
</div>
`;
}
render(App, document.getElementById('root'));
</script>
</head>
<body>
<div id="root">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment