Persist State to localStorage in React (Complete Tutorial)

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2024

Комментарии • 39

  • @АлексейСтепанов-к9о
    @АлексейСтепанов-к9о 24 дня назад +2

    Nice example of custom hook for local storage.

  • @hooooman.
    @hooooman. 26 дней назад +2

    When he dropped a 19 min video just for localStorage, I realised that there are far more things about localStorage that I have no idea about lmao

  • @zynpkkose
    @zynpkkose 13 дней назад

    It's very understandable. Thanks!😊

  • @viniciusm.m.7822
    @viniciusm.m.7822 18 дней назад

    wow, great job!
    Thanks!

  • @JeekChou
    @JeekChou 7 дней назад

    Great video❤

  • @Deus-lo-Vuilt
    @Deus-lo-Vuilt 27 дней назад

    Excellent material as always compa

  • @jaecheokkim99
    @jaecheokkim99 27 дней назад

    I really enjoyed your video. It was excellent! I really appreciate it!

  • @nourmustafa5094
    @nourmustafa5094 26 дней назад

    The best as always ❤

  • @Niamudeen
    @Niamudeen 25 дней назад

    Nice explanation

  • @MChiemelie
    @MChiemelie 27 дней назад

    Thank you very much. I needed this.

  • @amirhossein.banaei
    @amirhossein.banaei 25 дней назад

    grate explanation

  • @VictorScript
    @VictorScript 27 дней назад

    My hero 🎉

  • @ezetenduwilliams7322
    @ezetenduwilliams7322 25 дней назад +1

    First, instead of using type unknown you can use a generic type for setting item in the local storage. I’ve done it countless times and it works well

  • @edward-vonschondorf-dev
    @edward-vonschondorf-dev 23 дня назад

    Great video, will probably actually use this for a project i'm working on currently. Btw your Source Code link in the description is broken currently. I was able to find it though from going through your code monorepo and going to the persist-state-localStorage-tutorial repo within it.

  • @kevinpruett
    @kevinpruett 26 дней назад +2

    Would useSyncExternalStore be a more reliable approach here?

  • @Web-Dev-Codi
    @Web-Dev-Codi 27 дней назад +8

    Show viewers how dope your tutorials are, then at the end advertise your course. Thank me later.

  • @manish6801
    @manish6801 26 дней назад

    Thanks for the information. I wanted to know why we are using useEffect to update the value of unnecessary re-rendring our component again instead we can set value in localStorage on button click
    Little bit of performance optimisation

  • @salmanrashid7000
    @salmanrashid7000 17 дней назад

    Woohoo

  • @waleedsharif618
    @waleedsharif618 26 дней назад

    I have never had function like that inside useState so something new for me here

  • @IrshadahmedJakati-zl2zr
    @IrshadahmedJakati-zl2zr 25 дней назад

    Please explain, persisting data in Zustland with initial value

  • @sriramvenkatesh
    @sriramvenkatesh 27 дней назад

  • @tobisamuel8940
    @tobisamuel8940 27 дней назад

    🤩🤩🤩🤩

  • @geforcesong
    @geforcesong 23 дня назад

    Works great! However, do you have any lib recommendations that we can use directly? I see many of them have these hooks, like react-use, ahook... I don't think in reality we need write our own.

  • @prashlovessamosa
    @prashlovessamosa 27 дней назад

    can you please share upcoming chapters and modules.

  • @prashlovessamosa
    @prashlovessamosa 27 дней назад

    cover indexeddb too.

  • @irfansaeedkhan7242
    @irfansaeedkhan7242 27 дней назад

    is there any chance you apply some percentage off for few hours or days on project react

  • @Immelstorn
    @Immelstorn 26 дней назад

    Any reason to not put setItem inside useEffect cleanup function?

    • @kalideb-y3y
      @kalideb-y3y 22 дня назад

      I don't understand what you're trying to say

  • @harag9
    @harag9 27 дней назад +2

    @5:40 why did you use type unknown rather than type any for the initialValue parameter?

    • @cosdensolutions
      @cosdensolutions  26 дней назад +1

      type any usually isn't recommended and can throw linting errors in many projects, unknown is a more specific type that fits here better

    • @harag9
      @harag9 26 дней назад

      @@cosdensolutions Thanks for that. Project I took over recently has "any" everywhere, even though the original devs added TS to the package file. Wasn't aware of "unknown" or it's use case, but this makes perfect sense. :)

  • @nafg613
    @nafg613 26 дней назад

    You're assuming the caller wants to log and ignore errors

  • @snacksports8188
    @snacksports8188 25 дней назад

    Sir, I have a job, but I face a lot of stress. People often point out mistakes in my work repeatedly, and I constantly fear losing my job. This causes me a lot of tension, and I can't focus well. How can I control all of this

    • @samuelimafidon
      @samuelimafidon 20 дней назад

      Do not fret, take their feedback onboard and learn from it. At some point you’d exhaust their ‘mistakes curriculum’ and you’d gain confidence and be better. We all learn on the Job

  • @dadaarno6194
    @dadaarno6194 27 дней назад +1

    Hi! Is it another way to achieve the useLocaleStorage your teaches us a year ago ? Or is it something really different ?

    • @cosdensolutions
      @cosdensolutions  27 дней назад +2

      yeah exactly, different way of the same thing!

  • @snacksports8188
    @snacksports8188 27 дней назад

    You’re very beautiful; what’s is secret What is the secret to beauty 😀

  • @ahmadaltmeme4834
    @ahmadaltmeme4834 27 дней назад