The onMount function schedules a callback to run as soon as the component has been mounted to the DOM.
It must be called during the component's initialisation (but doesn't need to live inside the component;
it can be called from an external module).
If a function is returned synchronously from onMount, it will be called when the component is unmounted.
The
onMount
function schedules a callback to run as soon as the component has been mounted to the DOM. It must be called during the component's initialisation (but doesn't need to live inside the component; it can be called from an external module).If a function is returned synchronously from
onMount
, it will be called when the component is unmounted.onMount
does not run inside a server-side component.https://svelte.dev/docs/svelte#onmount