<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Никита Бобченок</title>
    <description>The latest articles on DEV Community by Никита Бобченок (@bladddddde).</description>
    <link>https://dev.to/bladddddde</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2235684%2Fce9d5ceb-45c5-42d9-b951-68b6e9f4b628.png</url>
      <title>DEV Community: Никита Бобченок</title>
      <link>https://dev.to/bladddddde</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bladddddde"/>
    <language>en</language>
    <item>
      <title>The list is not updated when adding a new item via useState()</title>
      <dc:creator>Никита Бобченок</dc:creator>
      <pubDate>Sat, 19 Oct 2024 21:30:30 +0000</pubDate>
      <link>https://dev.to/bladddddde/the-list-is-not-updated-when-adding-a-new-item-via-usestate-15op</link>
      <guid>https://dev.to/bladddddde/the-list-is-not-updated-when-adding-a-new-item-via-usestate-15op</guid>
      <description>&lt;h2&gt;
  
  
  Hey, everybody
&lt;/h2&gt;

&lt;p&gt;A problem (misunderstanding) has arisen with the useState hook.&lt;br&gt;
I have two custom hooks:&lt;/p&gt;

&lt;p&gt;1) &lt;em&gt;useLocalStorage.ts&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7bwp5i5qgm918byufp8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7bwp5i5qgm918byufp8.png" alt="Image description" width="718" height="674"&gt;&lt;/a&gt;&lt;br&gt;
Used to interact with localstorage.&lt;/p&gt;

&lt;p&gt;2) &lt;em&gt;usePlaylist.ts&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpj860dw6egh7lumdvi2h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpj860dw6egh7lumdvi2h.png" alt="Image description" width="612" height="938"&gt;&lt;/a&gt;&lt;br&gt;
Used to add/remove playlists, as well as get the full playlist&lt;/p&gt;

&lt;p&gt;I have a react component with which I add a new playlist using the &lt;strong&gt;&lt;em&gt;usePlaylist&lt;/em&gt;&lt;/strong&gt; hook&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F80j32cqo5r4wfb7pspze.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F80j32cqo5r4wfb7pspze.png" alt="Image description" width="314" height="126"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And then I have a react component that displays a list of playlists:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4hleuqnmizpwx0c4dzjr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4hleuqnmizpwx0c4dzjr.png" alt="Image description" width="551" height="891"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;BUT AFTER ADDING A NEW PLAYLIST, THEIR LIST IS NOT UPDATED(only when the page is refreshed)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;I have tried a lot of things, but maybe I missed something or misunderstood something, &lt;strong&gt;help please&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>react</category>
      <category>help</category>
      <category>nextjs</category>
    </item>
  </channel>
</rss>
