The new React “use()” hook in 15mins

Опубликовано: 31 Декабрь 2024
на канале: Frontend Interview Pro
332
23

In this video, I'll teach you how to use the brand new use() hook in React. The use() hook can be used to read data from promises and context. Additionally, while the promise is being resolved by the use() hook, you can show loaders using the Suspense component and error messages using the ErrorBoundary component. The hook can also be called inside if-else statements and loops, making it extra special.

Timestamps -

0:00 Introduction
1:00 Actual tutorial starts
1:16 use hook with promises
3:10 Using suspense to show a loading screen while use hook resolves our promise
4:24 Using error boundary to show error screen when the promise fails to resolve
5:50 Caching of promise to prevent errors
10:25 Using use hook conditionally
12:25 Using use hook with loops
13:30 use hook cannot be used with try/catch
14:19 use hook with context

------------------

Follow me -

⚪ Instagram ➡   / manish_boro  
⚪ LinkedIn ➡   / manish-boro-692b16198  

------------------

My PC Specifications -

⚪ Graphic Card ➡ GALAX RTX 2060 https://amzn.to/3hmSsCZ
⚪ RAM ➡ HyperX Fury 8GB 3200MHz * 2 https://amzn.to/3k3Pc17
⚪ Processor ➡ Ryzen 5 3600 https://amzn.to/2FkQzd0
⚪ CPU Cooler ➡ CoolerMaster H410R https://amzn.to/3hql7rb
⚪ Motherboard ➡ MSI B450 Tomahawk Max https://amzn.to/2Fq10f6
⚪ Webcam ➡ Lenovo 300 FHD - FHD 1080P 2.1 Megapixel CMOS Camera, Ultra-Wide 95° Lens, 360 ° Rotation https://amzn.to/3JX4OkZ
⚪ Gaming Chair ➡ Green Soul Monster Ultimate Series (T) Multi Functional Ergonomic Gaming Chair with Premium & Soft Fabric https://amzn.to/3q9UCOe

** All the above mentioned links are affiliate links **

#React19 #ReactHooks #UseHook #JavascriptPromises #ReactContextApi #WebDevelopment #JavaScript #ReactJS