1. How does Svelte update the DOM when state changes?
- It re-renders the whole page from the server
- It diffs a virtual DOM tree on every change
- Compiled code updates only the nodes that depend on the changed state
- It reloads the component file in the browser
Show answer
Answer: Compiled code updates only the nodes that depend on the changed state
Svelte is a compiler; the work is decided at build time.
Lesson: What Svelte Is