React Hooks: useState

Поділитися
Вставка
  • Опубліковано 25 сер 2024

КОМЕНТАРІ • 12

  • @shadrack3370
    @shadrack3370 20 днів тому

    your videos are extremely underrated

  • @alexzahrai4703
    @alexzahrai4703 9 місяців тому

    You explained how to use useState really well and provided a great example. I especially liked how you broke down how to lift state up and share it between components. Thank you!

  • @sethurk
    @sethurk Рік тому

    Simply WoW! Great demo of async operation and use of useState. You make the underlying concepts so much clearer. Thank you Sam..

  • @user-oz8ql1iv6p
    @user-oz8ql1iv6p 3 місяці тому

    great work

  • @nickyggoodman
    @nickyggoodman 18 днів тому

    good series. thanks. dropping a comment for the yt algorithm :)))

  • @siavoshoon
    @siavoshoon Рік тому

    I truley enjoyed. Adding Favorite button was exciting part🤩

  • @aprilm2941
    @aprilm2941 Рік тому +2

    Great video. You make more complicated concepts easy to digest. Question though, why not use "getter" and "setter" language when talking about useState variables?

    • @SamMeechWard
      @SamMeechWard  Рік тому +5

      The words "getter" and "setter" are usually used in OOP language to talk about a method that will get or set a property on an object, usually with some syntactic sugar to hide that you're calling a method. In this case, the set function acts like a setter, but it's a little weird in it's behaviour because it doesn't actually set any value, nothing we can interface with anyway. Instead it enqueues a change that will happen upon the components re render, so it's more like a "set on re render also re render er"than a simple setter. As for the getter, well it's not a getter at all, it's just the value. Nothing fancy, just a value. To call it a getter might imply that the value could be used to get the most up to date version of the state, but this is not the case. Whatever references that value on the current render will always read that value, never a new value. You can test this by trying to create a simple stopwatch app without using the updater function.
      TL;DR
      The value isn't a getter, it's just a plain ol' js value
      The setter is kind of like a setter but different enough that I wouldn't use "getter" and "setter" and feel ok about it

    • @aprilm2941
      @aprilm2941 Рік тому

      I agree with everything you’re saying BUT you’re being too… what’s that word? Pedantic.

    • @SamMeechWard
      @SamMeechWard  Рік тому

      Yes! You’re welcome 🤗🤗🤗🤗

  • @maimoh8437
    @maimoh8437 Рік тому

    thanks 🔥

  • @Pareshbpatel
    @Pareshbpatel Рік тому

    {2023-07-10}