7 ms·
To my eye, this makes vanilla JS more like React rather than making vanilla JS reactive. I'm basically looking for an even lighter Svelte if I can get it. Maybe
by pjmq 3y ago
To my eye, this makes vanilla JS more like React rather than making vanilla JS reactive. I'm basically looking for an even lighter Svelte if I can get it. Maybe this just isn't for me!
- pfg_ 3y agoIf you just want to make vanilla js reactive, you can use solid js but without jsx (or something similar). This library could likely do the same. import { createRoot, createSignal, createRenderEffect } from "solid-js"; function SomeComponent() { const [count, setCount] = createSignal(0); const result = document.createElement("button"); createRenderEffect(() => result.textContent = "++ (" + count() + ")"); result.onclick = () => setCount(count() + 1); return result; } createRoot(cleanup => { const appv = document.getElementById("app"); appv.appendChild(SomeComponent()); });