Write Clean Code with React Suspense | React Error Boundaries Explained

  Рет қаралды 28,160

Dave Gray

Dave Gray

Күн бұрын

Пікірлер: 60
@mocastello9253
@mocastello9253 11 ай бұрын
what a really great video and best explaination of react error boundary I've ever seen!! I've got a valuable knowledge after that and knowing more about using the APIs of that library thank you for sharing your expertise with us! all best from Berlin
@ALLAOUAOKBA
@ALLAOUAOKBA 4 ай бұрын
All perfect thanks dave just one question: does suspense work only with server components also does it work with simple fetch example?
@mattburgess5697
@mattburgess5697 Жыл бұрын
Some of this feels like it’s being done at the wrong level. There might be an error on Dave, but not on Susan, and logically it should be able to show all the others, with an error on only the broken one. The same applies to the data access. In actual fact there were two requests, the first for the big list and one for the details. Logically the skeleton should be on the individual items rather than the whole block. I can see there being a place for placing a suspense or error boundary on the components in a loop but I do worry about the implications. In any case this is not the first time I’ve run into your content and you’ve definitely earned a sub from me. Good content aimed at real devs.
@stevereid636
@stevereid636 Жыл бұрын
Fantastic! I always get some valuable knowledge from everyone of your videos 👍🏾
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Glad to hear it!
@madhavnagpal1860
@madhavnagpal1860 Жыл бұрын
in PostList we havent returned null, while loading, then how useSwr notifiy Suspense that children are in loading state ?
@genesissaquibal3252
@genesissaquibal3252 Жыл бұрын
when im trying to import this useErrorHandler from react-error-boundary i got an error saying that it does not provide a named export for it.
@staybalancedn
@staybalancedn Жыл бұрын
What made you recommend the ZTM courses, I clicked on them expecting to see you as the teacher...Great video by the way
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
That would be nice, but no, I am not an instructor there. However, I do think they are a good resource for further learning.
@nicolaichristensen6531
@nicolaichristensen6531 Жыл бұрын
Apart from making super components by not following JSX standards, {component} vs , great video.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Thank you - timestamp and reference for me to review please 😃
@qwertyuio53
@qwertyuio53 Жыл бұрын
​@@DaveGrayTeachesCode Around 9:02. { content } could be turned into if you just defined it as a function that returns JSX, instead of `let content = Not like this`.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
@@qwertyuio53 that's a very common pattern though. But yes, it could work as a function. Any references I should read on why it is not recommended?
@qwertyuio53
@qwertyuio53 Жыл бұрын
@Dave Gray Not that I know of. I was just trying to point out the timestamp since op hasn't replied yet. Personally though, I would do it the function form so it's easier to track which are state/computed and which are components.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
@@qwertyuio53 coming back to this as I've searched "super component" and from my findings, the pattern I'm using doesn't reach the definition I'm finding. Still curious about OP's reference here. That said, here's an example of the pattern I'm using shown in the RTK Query docs tutorial (PostsList): redux.js.org/tutorials/essentials/part-7-rtk-query-basics#displaying-posts-with-queries
@carlosraul6578
@carlosraul6578 Жыл бұрын
Fantástico, muchas gracias amigo, justo lo que ocupo
@MOJICA7257
@MOJICA7257 Жыл бұрын
Good Job! Thanks For Sharing Dave.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
You're welcome! 💯
@okbaalla8451
@okbaalla8451 Жыл бұрын
Dave, you're a legend, P.E.R.F.E.C.T ❤❤❤❤
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
You are too kind - thank you!
@folarichards8704
@folarichards8704 Жыл бұрын
Does anyone know why I don't get syntax highlighting when I open a vite project in VSCode?
@ProMinecraftSprite
@ProMinecraftSprite Жыл бұрын
Do you have a video in which you explain the useContext hook?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
It is a chapter in my React for Beginners series here: kzbin.info/www/bejne/pJi5p3ebnNh0jZo I also use the useContext hook in several other videos on my channel 😀
@TravinskiyVladislav
@TravinskiyVladislav Жыл бұрын
Thank you, Dave
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
You're welcome!
@sakirhusain7276
@sakirhusain7276 Жыл бұрын
Thanks
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Welcome
@MegaClockworkDoc
@MegaClockworkDoc Жыл бұрын
Thank you for putting this together. 👍
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Glad you enjoyed it!
@DrewSpencer
@DrewSpencer Жыл бұрын
Great video! Is suspense ok to use with react-query or is it the same deal as SSR?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Here you go: tanstack.com/query/v4/docs/react/guides/suspense
@vinayakmane6414
@vinayakmane6414 Жыл бұрын
make a full course on NestJs please :)
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Great request!
@vinayakmane6414
@vinayakmane6414 Жыл бұрын
@@DaveGrayTeachesCode Please fulfill it sir.
@belkocik
@belkocik Жыл бұрын
How to implement scaling error boundary for different components (different messages depend on which page you are) in whole React application?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
A couple of things to notice about the error boundaries that I point out in the tutorial: 1) It applies to all child components of the parent you wrap in the error boundary. No need to wrap each component. Instead think about starting at the top of the section. 2) If you use the component from the docs like I did here, it will display the actual error message which could be helpful - not a custom message. If you really wanted custom messages, you could tweak the error fallback component to provide them.
@sarahibrahim8943
@sarahibrahim8943 Жыл бұрын
Thank youu 💖💖💖💖
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Welcome!
@siddiqahmed3274
@siddiqahmed3274 Жыл бұрын
Sir i want to ask on what should i learn react query or useSwr? i think they both do similar things as i have watched your videos on both. And thank you for the tutorial. suspense and error boundary is really great.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Thank you! Good question and yes, Tanstack Query (aka React Query) is good to know. It has different features that could be useful, too. I do really like SWR 2.0 as well. Keep learning something new every day! 💯🚀
@bekirs4240
@bekirs4240 Жыл бұрын
No wrong answer here, whatever you pick is a great option
@okonkwo.ify18
@okonkwo.ify18 Жыл бұрын
SWR is cooler
@mattburgess5697
@mattburgess5697 Жыл бұрын
I’ve only used React-Query, but they both look to be doing more or less the same thing. You won’t go wrong either way IMO.
@alexanderten9540
@alexanderten9540 Жыл бұрын
Suspend detecting indirect speech in the posts of 'current' user
@slahomar1497
@slahomar1497 Жыл бұрын
can I use suspense with Redux RTK ?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
I'm not seeing much on suspense in the RTK docs.
@7doors847
@7doors847 Жыл бұрын
🔥! 🤘
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
💯🚀🚀
@marouaniAymen
@marouaniAymen Жыл бұрын
Thanks for the video, but what if, our suspense have to show a full page spinner that is transparent above the current parent component instead of returning another component ?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
For this need, it sounds like you would need to apply a CSS class to the current component instead of changing components.
@marouaniAymen
@marouaniAymen Жыл бұрын
@@DaveGrayTeachesCode Ok, thanks
@kalupatrick6863
@kalupatrick6863 Жыл бұрын
Thanks. But, whats the difference between SWR and React Query
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
This question might make for a good comparison video. I just published a video on SWR 2.0 last week.
@ermias_bahru
@ermias_bahru Жыл бұрын
first comment
@divyanshusinghthakur1447
@divyanshusinghthakur1447 Жыл бұрын
Thanks
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Welcome
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 16 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 54 МЛН
Goodbye, useEffect - David Khourshid
29:59
BeJS
Рет қаралды 503 М.
Learn React Error Boundaries In 7 Minutes
7:07
Web Dev Simplified
Рет қаралды 127 М.
The Story of Concurrent React
11:59
uidotdev
Рет қаралды 161 М.
Suspense and Error Boundaries in React 18
7:24
Sam Selikoff
Рет қаралды 29 М.
The Suspense Drama: A Comprehensive Breakdown
55:40
Theo - t3․gg
Рет қаралды 121 М.
What is React Suspense? (including Suspense for Data Fetching)
13:00
Philip Fabianek
Рет қаралды 19 М.
I tried React and it Ruined My Life
1:19:10
Tsoding Daily
Рет қаралды 155 М.
This is the Only Right Way to Write React clean-code - SOLID
18:23