The useLayoutEffect Hook

Опубликовано: 30 Сентябрь 2022
на канале: Latte And Code
1,059
86

In this React video, I'll show you how the useLayoutEffect hook works, its differences from useEffect, and its main use cases.

👨🏼‍💻 Support me on Patreon:   / latteandcode  
☕️ Buy me a coffee: https://www.buymeacoffee.com/latteand...
💛 The folks at Garaje de Ideas sponsor Latte and Code and are looking for talent: http://bit.ly/garaje-tech-talento

This hook is one of the most surprising due to its similarity to the useEffect hook. According to the React documentation, the useLayoutEffect hook has an identical signature to useEffect, but it fires synchronously after all DOM mutations. In this video, you'll find the meaning of this phrase:

[00:00] Introduction
[00:51] The useLayoutEffect hook
[02:40] Comparing useEffect and useLayoutEffect
[05:00] Order of effects
[06:50] useLayoutEffect example
[09:50] Another useLayoutEffect example
[14:00] useLayoutEffect and React Native

In short, the useLayoutEffect hook is perfect for rendering the component before sending mutations to the browser's DOM. For all other cases, the useEffect hook provides everything we need.

💛 I hope you enjoy it!


На этой странице сайта вы можете посмотреть видео онлайн The useLayoutEffect Hook длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Latte And Code 30 Сентябрь 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,059 раз и оно понравилось 86 зрителям. Приятного просмотра!