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...
On this page of the site you can watch the video online Can you assign setState to ref attribute? with a duration of hours minute second in good quality, which was uploaded by the user UI Engineering 25 February 2024, share the link with friends and acquaintances, this video has already been watched 875 times on youtube and it was liked by 78 viewers. Enjoy your viewing!