Free
Brittney Postma
Brittney Postma

Svelte Basics - Reactivity

Assignments

Welcome back, earlier we talked about Svelte’s reactivity needing an assignment. For a state change to trigger a re-render, it needs to be assigned a new value. Because of this, some JavaScript methods, like push and splice won’t automatically trigger updates. We need to explicitly reassign the value.

Statements

Statements can also be made reactive by prefixing it with the dollar sign colon syntax. These can be single values or grouped with a block.