title: Svelte store function update
body: <p>Svelte store documentation shows String or Integer being updated, but I did not find any dynamic function in store.</p>
  <p>I don't understand how to make the <code>getData</code> function as a writable in order to notify the html of the change.</p>
  <p>In the following sample, I would like <code>b</code> to be shown after the <code>updateKey</code> function is called.</p>
  <p>You will find a minimal code in REPL here: <a href="https://svelte.dev/repl/3c86bd48d5b5428daee514765c926e58?version=3.29.7" rel="nofollow noreferrer">https://svelte.dev/repl/3c86bd48d5b5428daee514765c926e58?version=3.29.7</a></p>
  <p>And the same code here in case REPL would be down:</p>
  <p>App.svelte:</p>
  <pre><code>&lt;script&gt;
  import { getData } from './store.js';
  import { updateKey } from './store.js';
  setTimeout(updateKey, 1000);
  &lt;/script&gt;
  
  &lt;h1&gt;{getData()}!&lt;/h1&gt;
  </code></pre>
  <p>store.js</p>
  <pre><code>import {setContext} from 'svelte';
  import {writable} from 'svelte/store';
  
  var data = {
      'a': 'a',
      'b': 'b'
  };
  
  var key = 'a';
  
  export const getData = function() {
      return data[key];
  }
  
  export const updateKey = () =&gt; {
      key = 'b';
  }
  </code></pre>
  <p>The goal is to work with a dynamic function in the store.</p>