Svelte 2 vs 3: Cheat Sheet

This guide is a cheat sheet for upgrading to Svelte 3. It doesn't cover everything, but it should get you started!
PRs welcome at the GitHub repository

action-identifier

Actions are functions that are called when an element is created. They can return an object with a destroy method that is called after the element is unmounted:

Svelte 2


 

Svelte 3


 

action-inline

Actions are functions that are called when an element is created. They can return an object with a destroy method that is called after the element is unmounted:

Svelte 2


 

Svelte 3


 

binding

Svelte 2


 

Svelte 3


 

binding-shorthand

Data ordinarily flows down, from parent to child. The bind: directive allows data to flow the other way, from child to parent. Most bindings are specific to particular elements. The simplest bindings reflect the value of a property, such as input.value. If the name matches the value, you can use a shorthand.

Svelte 2


 

Svelte 3


 

component

Svelte 2


 

Svelte 3


 

component-non-imported

Svelte 2


 

Svelte 3


 

component-renamed

Svelte 2


 

Svelte 3


 

component-shorthand

Svelte 2


 

Svelte 3


 

computed

Svelte 2


 

Svelte 3


 

computed-default

Svelte 2


 

Svelte 3


 

computed-nested-destructuring

Svelte 2


 

Svelte 3


 

computed-whole-state

Svelte 2


 

Svelte 3


 

computed-whole-state-rest

Svelte 2


 

Svelte 3


 

data

Svelte 2


 

Svelte 3


 

data-arrow

Svelte 2


 

Svelte 3


 

data-imported

Svelte 2


 

Svelte 3


 

data-indentation

Svelte 2


 

Svelte 3


 

data-indentation-arrow

Svelte 2


 

Svelte 3


 

duplicate-declarations

Svelte 2


 

Svelte 3


 

event-handler-event-arg

Svelte 2


 

Svelte 3


 

event-handler-event-arg-context

Svelte 2


 

Svelte 3


 

event-handler-set

Svelte 2


 

Svelte 3


 

fire-from-event

Svelte 2


 

Svelte 3


 

fire-from-method

Svelte 2


 

Svelte 3


 

get

Svelte 2


 

Svelte 3


 

get-complex

Svelte 2


 

Svelte 3


 

globals

Svelte 2


 

Svelte 3


 

helper-non-function

Svelte 2


 

Svelte 3


 

helpers

Svelte 2


 

Svelte 3


 

immutable

Svelte 2


 

Svelte 3


 

method

Svelte 2


 

Svelte 3


 

method-async

Svelte 2


 

Svelte 3


 

method-identifier

Svelte 2


 

Svelte 3


 

namespace

Svelte 2


 

Svelte 3


 

oncreate

Svelte 2


 

Svelte 3


 

oncreate-arrow

Svelte 2


 

Svelte 3


 

oncreate-async

Svelte 2


 

Svelte 3


 

onstate

Svelte 2


 

Svelte 3


 

onupdate

Svelte 2


 

Svelte 3


 

preload

Svelte 2


 

Svelte 3


 

preserve-eof-newline

Svelte 2


 

Svelte 3


 

ref

Svelte 2


 

Svelte 3


 

ref-in-function

Svelte 2


 

Svelte 3


 

ref-in-function-destructured

Svelte 2


 

Svelte 3


 

script-less

Svelte 2


 

Svelte 3


 

setup

Svelte 2


 

Svelte 3


 

store

Svelte 2


 

Svelte 3


 

tag

Svelte 2


 

Svelte 3


 

transition

Svelte 2


 

Svelte 3