You might not need useEffect() ...
From Academind · · 21 min

The player loads from YouTube only when you click. It uses YouTube's privacy-enhanced mode.
If the video does not play, the owner may have turned off embedding. Watch it on YouTube instead.
Description
Learn all about useEffect() & React in-depth: https://acad.link/reactjs
🖥️ Official Website & Courses https://academind.com/courses/
💬 Academind Community https://academind.com/community
👋 Social Media https://twitter.com/maxedapps https://twitter.com/academind_real https://www.instagram.com/academind_real/ https://www.facebook.com/academindchannel/ https://www.linkedin.com/in/maximilian-schwarzmueller/ https://www.linkedin.com/in/manuel-lorenz-808b5185/ https://www.linkedin.com/company/academind-gmbh https://www.linkedin.com/school/academind-pro https://www.tiktok.com/@academind_real
00:00:00 useEffect() is often used incorrectly! 00:01:58 useEffect() basics 00:03:16 Setting dependencies correctly 00:08:27 Avoid infinite loops 00:09:56 Introduction to the problem of using useEffect() unnecessarily 00:10:20 Example 1: Use derived state instead 00:12:49 Example 2: Reset state with keys instead 00:17:15 Example 3: Don’t wrap synchronous APIs with useEffect() 00:18:32 Sometimes you DO need useEffect() 00:19:32 Consider replacing direct useEffect() usage with specialized libraries