Can you assign setState to ref attribute?

Publicado em: 25 Fevereiro 2024
no canal de: UI Engineering
875
78

What setState and refCallback have in common?
Unintuitive React Pattern that can help synchronize DOM Elements with Render Cycle.

⏱️Timestamps:
00:00 - Why assigning setState in ref is unintuitive
01:00 - Example from Popper.js
02:27 - How does it work?
03:08 - Is it safe?
05:24 - Is it breaking React Rules?
06:57 - Why would you want to use it?
09:31 - Lessons learned: When to use it

📖 Acknowledgments and further reading:
Popper Example: https://popper.js.org/react-popper/v2...
Popper, how it works explained: https://github.com/floating-ui/react-...
React's GitHub Discussion: https://github.com/facebook/react/iss...


Nesta página do site você pode assistir ao vídeo on-line Can you assign setState to ref attribute? duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário UI Engineering 25 Fevereiro 2024, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 875 vezes e gostou 78 espectadores. Boa visualização!