How do I use Svelte component lifecycle methods on StackBlitz?

131 views Asked by At

How do I use component lifecycle methods and other Svelte functionality within a Svelte app created using StackBlitz (https://stackblitz.com/fork/svelte)?

Usually I would just import this sort of thing as an ES import:

import { onMount } from 'svelte'

But this doesn't work.

1

There are 1 answers

0
Stephane Vanraes On BEST ANSWER

It looks like the Svelte version on StackBlitz is v2, if you want to use it you can find the documentation here. But I would advice to look for a service that has v3, like CodeSandbox