Learn React Hooks: useTransition - Simply Explained!

  Рет қаралды 29,266

Cosden Solutions

Cosden Solutions

Күн бұрын

Пікірлер: 63
@cosdensolutions
@cosdensolutions 8 ай бұрын
Hope you enjoyed the video! I also have a really cool and unique course that will teach you way more than this video. You'll learn how to build an actual complex project with React. It's called "Project React" and you can find it at cosden.solutions/project-react. Also, I have a free weekly newsletter called "Import React" with tutorials, news, and cool stuff about React! You can sign up at cosden.solutions/newsletter?s=ytc
@sumitdubey8695
@sumitdubey8695 6 ай бұрын
What you say "This is the last video you are ever going to watch", is actually 100% true. Just amazing explanation 👌🏻
@AnuragSingh-ev8qd
@AnuragSingh-ev8qd 9 ай бұрын
I had to watch few parts of the video twice, but got it at the end. Amazing explanation, you got one more subscriber 👍
@jacobwwarner
@jacobwwarner 6 ай бұрын
Beautiful. I didn't think you could have such a refined control of rendering by using hooks like this.
@ankurparchani3230
@ankurparchani3230 Жыл бұрын
I really don't have to go to another video for this topic ever again 👏🏻
@cosdensolutions
@cosdensolutions Жыл бұрын
There you go ☺️
@prakashbanjade4374
@prakashbanjade4374 Жыл бұрын
Cool, now I understand useTransition and I won't need to look at other videos and solutions for this. Great explanation.
@cosdensolutions
@cosdensolutions Жыл бұрын
happy to hear it!
@abeercodes
@abeercodes Жыл бұрын
whoever has found this video on KZbin is lucky
@EmmanuelOdii80
@EmmanuelOdii80 Жыл бұрын
Much simplified than the info from the docs :)
@adembenabdallah9678
@adembenabdallah9678 Жыл бұрын
I appreciate your work this helped a lot ❤❤. Your are the best who explain the hooks it is true the last video you need to watch ❣❣
@cosdensolutions
@cosdensolutions Жыл бұрын
thank you for the kind words!
@kofi7617
@kofi7617 2 ай бұрын
Thank you for the explanation, really loved it 🥰
@irradev
@irradev 8 ай бұрын
Amazing! I will refactor my code. Thanks so much!
@tusharghildiyal6814
@tusharghildiyal6814 Жыл бұрын
That was very clear and helpful brother. Thanks, much appreciated 🙌👏
@cosdensolutions
@cosdensolutions Жыл бұрын
Glad you enjoyed it!
@IAmRC1
@IAmRC1 10 ай бұрын
Nice explanation buddy!
@mikewski4410
@mikewski4410 Жыл бұрын
Pretty clean explanation. Easy to understand. Thank you
@literallyshane4306
@literallyshane4306 3 ай бұрын
awesome, thank you, these videos are really clear :)
@michaelm8044
@michaelm8044 Жыл бұрын
Sick video. Pretty advanced stuff.
@sviatoslav8776
@sviatoslav8776 5 ай бұрын
Great explanation. Thanks a lot 👍
@stepanostapuk4120
@stepanostapuk4120 Жыл бұрын
Thank you for the video!
@sudiptagogoi1431
@sudiptagogoi1431 Жыл бұрын
Thanks a lot cosden
@tangsi721
@tangsi721 5 ай бұрын
perfect example
@garudaphoenix5479
@garudaphoenix5479 Жыл бұрын
Thanks, man, clearly explained 💖💖
@awekeningbro1207
@awekeningbro1207 5 ай бұрын
so basically useTransition is just debouncing the function to be invoked a little bit later(in milliseconds)?
@gmjitendra
@gmjitendra Жыл бұрын
Excellent.
@vuongal1658
@vuongal1658 Жыл бұрын
Thank you so much!!!
@subhashmalireddy
@subhashmalireddy 3 ай бұрын
It'd be great if you can explain the caveats mentioned on the react docs as well 🙌🙏. TIA
@vinothkumarv9722
@vinothkumarv9722 6 ай бұрын
Awesome :)
@bibahbibah5108
@bibahbibah5108 Жыл бұрын
u are right i don't need to read or see another thing
@robertomolinasilvera4863
@robertomolinasilvera4863 10 ай бұрын
React sends one rerender with currentState and isPending:true to component to tell it will start transition. Then it will rerender component with newState if during this rerender (probably slow) another update is raised, async rerender will be stopped
@sohailmohammed4024
@sohailmohammed4024 4 ай бұрын
Nice
@Shaheer-xs5os
@Shaheer-xs5os Жыл бұрын
Bro that was helpful 😄😊
@PfutIndustries
@PfutIndustries 10 ай бұрын
your a goat
@Herxh428
@Herxh428 Жыл бұрын
Clean
@jerrykodes
@jerrykodes 7 ай бұрын
Quick Question? Can I use the useTransition to put the loading state for side effects functions For e.g. if I have to update the user and I'll wrap the start transition on update function. I can use the isPending state to show that is updating or likewise.
@RajkumarSingh-i5n
@RajkumarSingh-i5n 3 ай бұрын
Don't you think web worker does similar thing. But nice explanation sir.
@srinivasreddysagi8722
@srinivasreddysagi8722 2 ай бұрын
Subscriber++ 😁
@dominggusoctovianus4915
@dominggusoctovianus4915 Жыл бұрын
Simple but so juice... hehe
@rockstarshahid
@rockstarshahid 7 ай бұрын
Awesome. Simple and clear explanation. But I have a question regarding POSTS page. How can we resolve the UI freezing issue for Posts page? Or how can we load Posts page content faster? Can you help me with this? Thanks.
@cosdensolutions
@cosdensolutions 7 ай бұрын
only render a few at a time. So either use virtualization, or paginate them and load them 20 at time
@VuDuc-lw5xp
@VuDuc-lw5xp 4 ай бұрын
Hi, I can understand the abstract part that useTransition discards non-urgent action and handle urgent action. But can someone help me explain how startTransition discards post behind the scene with Javascript side? Because in my knowledge, when a synchronous is execute like a Post component in video, we can't discard it with outside code. So how useTransition can do that?
@awekeningbro1207
@awekeningbro1207 5 ай бұрын
does the useTransition hook work with react's userReducer just like it would be useState?
@tnarra
@tnarra Жыл бұрын
Why does my script to animate in page router doesn't work in app router of nextjs
@MuhammadUsman-ng3kn
@MuhammadUsman-ng3kn 4 ай бұрын
so it work like lazy loading?
@deliotablang823
@deliotablang823 Жыл бұрын
seems like same with the suspense lazy load what are the difference between them?
@cosdensolutions
@cosdensolutions Жыл бұрын
suspense is for delaying the loading of something and this is for interrupting it and prioritising other renders first
@deliotablang823
@deliotablang823 Жыл бұрын
Many thanks. Is this working also using next/link?
@StingSting844
@StingSting844 Жыл бұрын
Neat. So what happens to components that render direct from manipulations like chart libraries or canvas libraries? They don't work because react has no way to stop them right?
@cosdensolutions
@cosdensolutions Жыл бұрын
depends, if they are driven by state, this will control when that state gets interrupted or not
@fullstackprojects5615
@fullstackprojects5615 Жыл бұрын
hello, Can you explain this one please - while (performance.now() - startTime < 1) { console.log("entered while...", performance.now()); // Do nothing for 1 ms per item to emulate extremely slow code } performance.now() - startTime < 1 should always be greater than 1 isn't it? I don't know why is it going inside the while loop and what does 1ms delay is derived. Would be great if you can please explain.
@cosdensolutions
@cosdensolutions Жыл бұрын
this code just forces the component to wait 1ms before continuing the render. It comes from the React docs in their examples! It just simulates slowness so that you can actually see the effects of what you are doing
@王俊-l4e
@王俊-l4e Жыл бұрын
why not use loading instead
@veerasamysevagen9533
@veerasamysevagen9533 11 ай бұрын
Hello, Loved your explanation but it does not seem to work with this piece of code. const buttonClick = (type: string) => { startTransition(() => { if(type === "fast") { setCounter(25); } else { setCounter(() => { let sum = 0; for(let i =0; i
@cosdensolutions
@cosdensolutions 11 ай бұрын
because startTransition works by interrupting renders that take too long after being set, not the actual setting of a new value. In your case, you're just taking a while to set the new value to trigger a re-render, but the actual re-render is super fast as it will just update the counter with one value
@veerasamysevagen9533
@veerasamysevagen9533 11 ай бұрын
@@cosdensolutions makes sense yeah. Thanks a lot for responding.
@danielvega646
@danielvega646 2 ай бұрын
5:12
@NoName-j8j3o
@NoName-j8j3o Жыл бұрын
Its look like debounce or throthle
@cosdensolutions
@cosdensolutions Жыл бұрын
It does
@agustind
@agustind Жыл бұрын
I promess you after reading this comment you wont have to read any other comment again
@cosdensolutions
@cosdensolutions Жыл бұрын
Thanks you saved me
@bq_wang
@bq_wang Жыл бұрын
Learn React Hooks: useDeferredValue - Simply Explained!
12:02
Cosden Solutions
Рет қаралды 16 М.
Learn React Hooks: useCallback - Simply Explained!
17:15
Cosden Solutions
Рет қаралды 105 М.
1, 2, 3, 4, 5, 6, 7, 8, 9 🙈⚽️
00:46
Celine Dept
Рет қаралды 115 МЛН
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 15 МЛН
Thank you Santa
00:13
Nadir Show
Рет қаралды 31 МЛН
useTransition() vs useDeferredValue | React 18
16:22
Academind
Рет қаралды 96 М.
ALL React Hooks Explained in 12 Minutes
12:21
Code Bootcamp
Рет қаралды 160 М.
Custom Hooks in React (Design Patterns)
12:56
Cosden Solutions
Рет қаралды 52 М.
Learn React Hooks: useLayoutEffect - Simply Explained!
9:17
Cosden Solutions
Рет қаралды 20 М.
Learn React Hooks: useMemo - Simply Explained!
13:41
Cosden Solutions
Рет қаралды 113 М.
This is the Only Right Way to Write React clean-code - SOLID
18:23
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 489 М.
You Are Using useEffect Wrong
14:40
Cosden Solutions
Рет қаралды 36 М.
Are we going back to PHP with fullstack JavaScript?
9:57
Maximilian Schwarzmüller
Рет қаралды 153 М.
10 common mistakes with the Next.js App Router
20:37
Vercel
Рет қаралды 230 М.
1, 2, 3, 4, 5, 6, 7, 8, 9 🙈⚽️
00:46
Celine Dept
Рет қаралды 115 МЛН