title: Can't fetch data from API in SvelteKit
body: <p>I am trying to display data I request by fetch from API. Everything works well except fetch.</p>
  <p>This is my component named <code>Items.svelte</code>:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;script&gt;
    let items = [];
  
    async function load({ fetch }) {
      const url = &quot;../r/api/items/all&quot;;
      let res = await fetch(url);
  
      if (res.ok) {
        return {
          props: {
            items: await res.json(),
          },
        };
      }
      return {
        status: res.status,
        error: new Error(),
      };
    }
  &lt;/script&gt;
  
  {#each items as item}
    &lt;header&gt;
      &lt;h2&gt;{item.title}&lt;/h2&gt;
      &lt;p&gt;{item.body}&lt;/p&gt;
    &lt;/header&gt;
  {/each}
  
  </code></pre>
  <p>This is <code>App.svelte</code>:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;script&gt;
    import Items from '$lib/Items.svelte';
  &lt;/script&gt;
      
  &lt;Items /&gt; 
  </code></pre>
  <p>What am I doing wrong?</p>