DEV Community

Discussion on: Building an Application with GraphQL and SvelteKit

Collapse
vladimirdrayling profile image
Vladimir Drayling

Thank you!

I got $data is undefined. Fixed it with

{#if $data}
    {#each $data.characters.results as character (character.id)}
        <section style={`background-image: url(${character.image})`}>
            <h2>{character.name}</h2>
        </section>
    {/each}
{:else}
    loading
{/if}
Enter fullscreen mode Exit fullscreen mode