Why React Strict Mode breaks your app – on purpose

preview_player
Показать описание
Check out my premium video courses on Build UI:
Рекомендации по теме
Комментарии
Автор

Bro I'm an experienced react dev so I already know most of the stuff you talk about. But you are probably the best coding YouTuber on the platform, no yelling mild takes, not pushing an agenda, just clean, precise and interesting content. Keep it up!

deiminator
Автор

That probably explains why I get the api calls with react query running twice on mount, good thing I started using the signal to abort the request on cleanup.
I was aware of React's strict mode, but never understood it correctly, this video made it very clear, thank you!
And I think strict mode is a must, very useful.

wfl-junior
Автор

bro why are you so good in teaching?! Its abnormal that I'm able to grasp every single word that comes out of your mouth!

StingSting
Автор

Love the video and your production style! Learned some good stuff here. (It could have been slightly higher pace or shorter, but otherwise really good!)

HaraldLønsethagen-ct
Автор

The way you talk is really awesome man!! And I never heard about chaos monkey. Thanks

HarshilParmar-fd
Автор

Thanks! I often misunderstand the whole concept of strict mode. One time I was fetching the data multiple times and end up wasting 1 day only to find out it was happening bcz of the strict mode tho:)

codingwithdidem
Автор

Your vim chops are smooth..
I’ve also got into it last month

_vay
Автор

The production value of this video is so high. Damn man, even down to that exceptionally groomed beard 😂 You're basically the Wenger of dev content!

mmmikem
Автор

I’ve always enjoyed your streams while you’re working on Mirage. When I get a notification for a new video from you, I get really excited, and you never disappoint. Keep on going! Your videos are insanely good. Quality content, superb delivery. Only a if you make them more often.

cdes
Автор

Sheesh this was really great! I knew about the "cleanup" return function in useEffect, but I have probably done that mistake 100 times in my apps, and never noticed 😅 Also - the backlight doubling as practical light in the background is 🧑‍🍳😘

simonswiss
Автор

This is great! Thank you so much for this breakdown! 🙏

HeyNoah
Автор

O wow, I was wondering WTF this was all about, thanks

danielxxgadd
Автор

At 2:14 when you said "callback function is closing over the count variable from state" I think the terminology is not correct. IMHO closure won't happen due to shadowing (same name "count" used both in effect and outer variable). But the interval will still refer to that state variable as long as it runs. Anyway I came here after reading your article "Instant Search Params with React Server Components" - which was very good!

gmoniava
Автор

React Strict Mode white background blinded me, now I sing about just calling someone and saying I love you.

justine_chang
Автор

The proper way to implement this is to instead use setTimeout and add count as a dependency, so that when count is updated it restarts the timeout. setInterval should never be used as it does not guarantee execution if the inner function takes longer than the interval. (there are other issues with setInterval as well - can google it for more info)

kevinbatdorf
Автор

React Strict mode simple replaces a "maybe" bug with a "certain" but which noob/blind devs might miss
and therefore introduce bugs into the system. Strict mode is a big no-no for me, for years. It's catastrophic.

yairvsync
Автор

For me most of the time is i dont get errors with strict mode in dev but when in Prod then i start getting issues

ThomazMartinez
Автор

this is completely broken when you try to use refs

pelaoinfo
Автор

Yeah, I would rather Ract just tells me with a yellow warning and let me figure out if I have to clean up the effect dammit! Its a dumb idea.

id
Автор

Why was this in my recommended? lmao im not close to be a programer xD cool explanation tho 👍

clear_out
join shbcf.ru