title: SvelteKit Navigation goto State
body: <p>In SvelteKit navigation <a href="https://kit.svelte.dev/docs#modules-$app-navigation" rel="nofollow noreferrer">goto</a> allows to pass <code>state</code> in the second argument such as:</p>
  <pre><code>import { goto } from '$app/navigation';
  
  // ...
  
  goto('/login', { state: { foo: 'bar' } });
  </code></pre>
  <p>The documents do not make it clear how <code>state</code> can be consumed/retrieved after the resulting navigation has occurred. <code>state</code> does not seem to be present on <a href="https://kit.svelte.dev/docs#modules-$app-stores" rel="nofollow noreferrer">$page</a> nor seems to be available on <code>$navigating</code>.</p>
  <p>How do you consume <code>state</code> passed to second argument of <code>goto()</code>? Is it currently missing and you have to create your own writable store to manage this state?</p>
  <p>This is an <a href="https://github.com/sveltejs/kit/tree/master/packages/adapter-static" rel="nofollow noreferrer">adapter-static</a> SvelteKit application.</p>