Posts

Showing posts with the label Svelte

Svelte Explained: The Framework That Disappears

Introduction React, Vue, and Angular all work the same way at runtime: they ship a framework to the browser, which watches your data and updates the page. Svelte takes a radically different approach — it is a compiler. It turns your components into plain JavaScript at build time, and ships no framework at all. The result: smaller bundles, faster pages, and code that reads almost like plain HTML, CSS, and JavaScript. Reactivity without ceremony In React you need hooks and state setters; in Svelte, reactivity is just assignment. Change a variable, and the page updates: <script> let count = 0; </script> <button on:click={() => count += 1}> Clicked {count} times </button> There is no useState, no setter function, no virtual DOM diffing. The compiler sees count += 1 and generates the exact code to update the button text. Less code to write, less code shipped, and nothing to learn beyond assignment. One file, three familiar languages A Svelte component k...