Svelte is gaining massive traction. Why? Because it moves the “framework” from the browser to the compiler.
No Virtual DOM
React diffs the Virtual DOM on every render. Svelte compiles your components into imperative vanilla JavaScript code that updates the DOM directly when state changes.
Reactivity Syntax
React uses hooks. Svelte uses… JavaScript.
React
const [count, setCount] = useState(0);
useEffect(() => {
console.log(count);
}, [count]);
Svelte
let count = 0;
$: console.log(count); // Reactive statement
I find Svelte fantastic for small-to-medium apps and high-performance visualizations. React’s ecosystem is still unbeatable for large enterprise apps, but SvelteKit is closing the gap.
Discover more from C4: Container, Code, Cloud & Context
Subscribe to get the latest posts sent to your email.