title: Revalidating data using mutate in SWR - Which should I use?
body: <p>In my app every time the user creates a new album the post request response responds with a list of the updated list of albums.</p>
  <p>To provide a better user experience, I wanted the user to see the new content in the app without having to refresh the page.</p>
  <p>I'm aware of the existence of SWR's mutate, but so far, I couldn't make it work.</p>
  <p>I tried to set a 1000ms <code>refreshInterval</code> in my hook, but I wanted to know how to do it by using the mutate. Here's what I tried:</p>
  <p>SWR hook</p>
  <pre><code>const fetcher = async (url: string, param: string) =&gt; {
      const res = await fetch(url + param);
      
     return res.json();
  };
  
  
  const { data, error } = useSWR(
   [&quot;/api/albums/list?id=&quot;, appUser.id],
    (url, params) =&gt; fetcher(url, params)
  );
  
  </code></pre>
  <p>Inside the <code>createAlbum</code> function:</p>
  <pre><code>const data = await response.json();
  
  mutate(&quot;/api/albums/list&quot;, data.newAlbums, false);
  </code></pre>
  <p>I would be happy to get some feedback.</p>