1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Use an onMount lifecycle method to fetch and render data in Svelte 3

    sveltesvelte

    Every Svelte component has a lifecycle that starts when it is created, and ends when it is destroyed. There are a handful of functions that allow you to run code at key moments during that lifecycle.

    The one you'll use most frequently is onMount, which runs after the component is first rendered to the DOM.

    In this lesson we're going to learn how to use onMount to fetch and render data from Star Wars API.