Тёмный

Why React Strict Mode breaks your app - on purpose 

Sam Selikoff
Подписаться 66 тыс.
Просмотров 8 тыс.
50% 1

Check out my premium video courses on Build UI:
buildui.com

Развлечения

Опубликовано:

 

7 апр 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 29   
@deiminator2
@deiminator2 Год назад
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 RU-vidr on the platform, no yelling mild takes, not pushing an agenda, just clean, precise and interesting content. Keep it up!
@robbyoconnor
@robbyoconnor Год назад
I've met him in person... he's like this in person as well. Very down to earth
@samselikoff
@samselikoff Год назад
Really appreciate this message 😊 👊
@UncleDavid
@UncleDavid Год назад
he has baraka in him lol
@Developer888
@Developer888 Год назад
As a react rookie, I appreciate the breakdown
@wfl-junior
@wfl-junior Год назад
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.
@StingSting844
@StingSting844 Год назад
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!
@codingwithdidem
@codingwithdidem Год назад
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:)
@HeyNoah
@HeyNoah Год назад
This is great! Thank you so much for this breakdown! 🙏
@cdes
@cdes Год назад
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.
@user-ze5ew6fh2i
@user-ze5ew6fh2i Год назад
The way you talk is really awesome man!! And I never heard about chaos monkey. Thanks
@simonswiss
@simonswiss Год назад
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 🧑‍🍳😘
@andrewsidorchuk9289
@andrewsidorchuk9289 Год назад
Awesome explanation! Thanks man
@_va3y
@_va3y Год назад
Your vim chops are smooth.. I’ve also got into it last month
@pablozuta2402
@pablozuta2402 Год назад
That's vscode bro
@tefkah
@tefkah Год назад
@@pablozuta2402 yeah but he's clearly using vim bindings
@samselikoff
@samselikoff Год назад
Best investment you’ll ever make!
@flying_salt
@flying_salt 7 месяцев назад
Thanks a lot
@typescripter
@typescripter Год назад
Thx
@kevinbatdorf
@kevinbatdorf Год назад
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
@kevinbatdorf Год назад
Also, I'm not being critical of your content. I know it wasn't the point of this video. Keep it coming!
@samselikoff
@samselikoff Год назад
The logic is "increase the count by 1 every second" - that's an interval. You don't want to use count as a dependency to achieve this behavior for two reasons: first, it's literally not a dependency when using the function version of setState, and second (and more importantly), count could change for reasons other than the interval increasing it. (If you wanted different logic based on count changing for other reasons, that would also be achievable, but it's a different requirement.) I'm not sure I understand your point about "the inner function taking longer than the interval". The inner function here is just a call to setState and is not asynchronous code, and it would be the same if it were in a timeout. You can absolutely use setInterval in React applications. There do exist libraries like useInterval which offer more functionality, but they ultimately are more sophisticated wrappers around setInterval. (And no criticism taken, I welcome the questions!)
@justine_chang39
@justine_chang39 Год назад
React Strict Mode white background blinded me, now I sing about just calling someone and saying I love you.
@mmmike3426
@mmmike3426 Год назад
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!
@ThomazMartinez
@ThomazMartinez Год назад
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
@pelaoinfo
@pelaoinfo 4 месяца назад
this is completely broken when you try to use refs
@clear_out6474
@clear_out6474 Год назад
Why was this in my recommended? lmao im not close to be a programer xD cool explanation tho 👍
@yairvsync
@yairvsync 10 месяцев назад
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.
Далее
React vocab explained: What is Concurrent React?
17:14
Why Signals Are Better Than React Hooks
16:30
Просмотров 457 тыс.
Gale Now VS Then Edit🥵 #brawlstars #shorts
00:15
Просмотров 376 тыс.
You are using useFetch WRONG! (I hope you don't)
11:14
Why you should lift component state up to the URL
34:27
Goodbye, useEffect - David Khourshid
29:59
Просмотров 494 тыс.
9 JavaScript Features You’ve Never Used
19:36
Просмотров 26 тыс.
Highlight any panel in your dashboard
10:41
Просмотров 9 тыс.
Fixing a React navigation bug
57:03
Просмотров 7 тыс.
Animated tabs - with inverted text!
12:15
Просмотров 54 тыс.
ПРЕДСКАЗАТЕЛЬ БУДУЮЩЕГО
1:00
Просмотров 4,4 млн
Идеальный день ребёнка😂
0:11
Просмотров 1,8 млн