Refs in React: from access to DOM to imperative API

Поділитися
Вставка
  • Опубліковано 27 бер 2023
  • 👉 Advanced React Book: www.advanced-react.com
    👉 Refs in React: from access to DOM to imperative API: www.developerway.com/posts/re...
    💬 Twitter: / adevnadia
    💬 Linkedin: / adevnadia
    👩🏼‍💻 Simple ref use: codesandbox.io/s/giant-form-r...
    👩🏼‍💻 Pass ref as a prop: codesandbox.io/s/example2-pas...
    👩🏼‍💻 Pass ref with forwardRef: codesandbox.io/s/example3-pas...
    👩🏼‍💻 Imperative API with useImperativeAPI hook: codesandbox.io/s/example4-imp...
    👩🏼‍💻 Imperative API without that useImperativeAPI hook: codesandbox.io/s/example5-imp...
    Looking into why we need access to DOM in React, how Refs can help with that, what are useRef, forwardRef and useImperativeHandle hooks, and how to use them properly.
    #react #reactjs #webdevelopment #programming #frontend #frontenddeveloper #js #javascript

КОМЕНТАРІ • 23

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

    wow, this is the video containing all of the knowledge about useRef as I know 🤯

  • @thiagopuntar
    @thiagopuntar Рік тому +3

    Oh, missed you! Thank you so much for all your articles. Please keep doing more and more!😍

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

    thank you for this well explained and nicely animated video, so much easier to understand

  • @dimau
    @dimau 10 місяців тому +2

    Спасибо за такую хорошую глубину разбора материала и восхитительную подачу! Раскладывает по полочкам в голове сложные темы :)

    • @developerwaypatterns
      @developerwaypatterns  9 місяців тому +1

      Thank you for the kind words! 😊

    • @userJakov
      @userJakov 8 місяців тому +1

      @@developerwaypatternsдобрый вечер, а у вас нет книг на русском языке?

    • @developerwaypatterns
      @developerwaypatterns  8 місяців тому +1

      @@userJakov Unfortunately, no :(

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

    Thanks for the video, I used the same pattern like you, but for using conditionals in order to activate/deactivate styles, I call the clsx library in order to toggle CSS classe names.

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

    Thank you very much! As always, to the point and I don't think I have seen better visuals anywhere around, I think they ccontribute well to your brands defferentiation when compared to code-along vids. Article and a vid is my favorite combination. To me, it's like an article is for sharpening my knowledge, video - for honing )

  • @vinitraut18
    @vinitraut18 4 місяці тому +1

    Thanks Nadia, great content as always!!!

  • @gaddp
    @gaddp Рік тому +1

    super clear video with a beautiful example. thanks Nadia!

  • @nicolasmenescardi4077
    @nicolasmenescardi4077 Рік тому +1

    Love your videos!! Thanks!

  • @assylzhanshabkhatov5763
    @assylzhanshabkhatov5763 Рік тому +1

    Really useful guide. Thanks!

  • @katsunoi
    @katsunoi 8 місяців тому +1

    great video!

  • @TheProfessionalGambler
    @TheProfessionalGambler 11 місяців тому +1

    Does React have any differences or caveats between inputRef={ref} and forwardRef()? It looks like the ref is just a unified version of the ref transfer in these cases.

  • @sushantrajbanshi4508
    @sushantrajbanshi4508 Рік тому +1

    So the *forwardRef* & *useImperativeHandle* are just syntactic sugars over manually passing refs & mutations ? Or are there any performance benefits on using them ?

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

      Yep, exactly. I'm not aware of any performance benefits of those vs just manually passing ref around, and I doubt there can be any.

  • @aeldarets
    @aeldarets Місяць тому

    How is this going to work with TypeScript?

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

    Love your blogs !! and now video content is cherry on top

  • @aaryansj8016
    @aaryansj8016 2 місяці тому

    Thanks... Wonderful Vidoes