The React Lifecycle: Simply Explained!

  Рет қаралды 13,270

Cosden Solutions

Cosden Solutions

Күн бұрын

Пікірлер
@edward-vonschondorf-dev
@edward-vonschondorf-dev 17 күн бұрын
Definitely interested in more videos involving looking behind the scenes of how all these meta frameworks/libraries actually work. Does a great job of de-mystifying things.
@TYTAX_HOME_GYMS
@TYTAX_HOME_GYMS 17 күн бұрын
Greetings from Poland. One of the best explanations of how React works that I have ever seen. I have been working with React and Next.js for two years and only now have I fully understood a few concepts of how React works. Thanks for this video.
@AjithkumarSekar
@AjithkumarSekar 17 күн бұрын
Wow.. what a timing. I was just looking for this 2 days ago and thought it would be nice if you have any videos on it
@ayushdedhia25
@ayushdedhia25 17 күн бұрын
Thank you for your videos. This one is very important video specially when you don't why your react code work unexpected because we don't know what actually happens BTS. This helps us to write better scalable code 🙏🏻
@germain1984
@germain1984 17 күн бұрын
love these types of videos, would be great if you used this format to go thru other concepts
@andyfoote8117
@andyfoote8117 16 күн бұрын
Great explanation. Useful to see the differences between the client/server implementation being explained.
@farzadmf
@farzadmf 17 күн бұрын
Very nice explanation; thank you!
@serdotsenko
@serdotsenko 17 күн бұрын
I loved how you explained the core concepts! To make this even more useful, I suggest adding a practical example, like a coding demo, to show how these ideas are applied in the real world.
@a-short-dev
@a-short-dev 17 күн бұрын
This is the best, I can now answer interview questions better
@mohamedsalimbensalem6118
@mohamedsalimbensalem6118 17 күн бұрын
Finally, the video that ive been waiting for, Thanks darius for the video ❤
@BarakAlmog
@BarakAlmog 8 күн бұрын
Great video. Appreciate your efforts 🙏
@AlphaTechy
@AlphaTechy 15 күн бұрын
Very nice explanation ❤ , Thanks
@kartikvishwakarma7567
@kartikvishwakarma7567 15 күн бұрын
Great explanation specially server components part. So what I get is every react lifecycle whether its mounting, updation, or unmounting it creates a new virtual dom and replaces the real dom with the nodes which are changed only, right?
@ptolemyhenson6838
@ptolemyhenson6838 16 күн бұрын
Does React run effect cleanup only after unmounting, or also before each rerun of the actual effect?
@cosdensolutions
@cosdensolutions 16 күн бұрын
Both
@tonyg_nerd
@tonyg_nerd 16 күн бұрын
@cosdensolutions Big thanks to you for this vid and all others. Please forgive a bit of fine-tuning: With a dependency array with elements, the cleanup function is executed before the effect re-runs due to a change in the dependencies. - Cleanup is not run if dependencies haven't changed. If the dependencies array is empty ([]), the effect runs only once when the component mounts, and the cleanup runs only once when the component unmounts. If no dependency array is provided, yes, the effect runs on every render, and the cleanup also runs before every re-run of the effect. If an async operation is performed in cleanup, It is not scheduled with priority before the effect. It's run synchronously, and any async handling will probably follow the effect processing. To summarize: - If the effect is going to run, cleanup will run before it. - If the effect is not going to run, cleanup will not run on re-render. - Cleanup always runs on unmount. - Avoid async in cleanup, or manage it carefully. I'm not being a smart-a** , these rules only became fully clear to me after watching this vid. Thanks!
@P.Shivakrishna
@P.Shivakrishna 17 күн бұрын
what about useRef in updating stage how it is act in every state ?
@cosdensolutions
@cosdensolutions 17 күн бұрын
it will update the value, but won't trigger a re-render. So the value will be updated in memory, but if you're using it in JSX, it won't be shown until something else triggers a re-render
@yogeshk4348
@yogeshk4348 17 күн бұрын
Love from INDIA ....
@sjoerdvermeijden
@sjoerdvermeijden 16 күн бұрын
So on every state change the VDOM is re-rendered?
@fitsaleem
@fitsaleem 14 күн бұрын
great cosden
@shahwaizkarim-h9z
@shahwaizkarim-h9z 16 күн бұрын
sir let's take this example code : useEffect(() => { const connection = createConnection(serverUrl, roomId); connection.connect(); return () => connection.disconnect(); }); As you said, when the component re-renders it runs the cleanup function at the end, and clean up function clears all the memory. If this happens then the connection should break due to a state change in component. Now this is pretty common we have to change states in every app. Would the connection break between two users if the cleanup function runs on state change in the above code?
@cosdensolutions
@cosdensolutions 16 күн бұрын
it would, but you would pass `serverUrl` and `roomId` as dependencies to useEffect, so that useEffect will only run when the server url changes or the room id, which is what you want. Otherwise, the component can re-render all it wants, the useEffect won't re-run unless its deps change
@shahwaizkarim-h9z
@shahwaizkarim-h9z 13 күн бұрын
@@cosdensolutions Thank you bro for the reply!
@ali.thecoder
@ali.thecoder 17 күн бұрын
Does this works in react native too ?
@cosdensolutions
@cosdensolutions 17 күн бұрын
yeah, except the server part is still pending
@jamesbotwina8744
@jamesbotwina8744 17 күн бұрын
Why isn't there an option to send you money through KZbin? This is a great video. I'd give you $2.
@cosdensolutions
@cosdensolutions 17 күн бұрын
appreciate the kind words!
@SieanLeon
@SieanLeon 17 күн бұрын
when the cleanup function is executed inside the useEffect() hook callback function? It’s kind of confusing the way useEffect() callback works. If this callback function is scheduled to be ran earlier why the its return only executed upon component unmount stage
@cosdensolutions
@cosdensolutions 17 күн бұрын
check my useEffect tutorial video! it explains it super nicely
@SieanLeon
@SieanLeon 16 күн бұрын
@ ok. 👌 Thanks! i’m just trying to refresh myself on latest React updates and implement later in my application UI. Some of these framework features had been forgotten already.
@developertools95
@developertools95 17 күн бұрын
u r my bosss
@johnforeverrules
@johnforeverrules 17 күн бұрын
first. nice video my man
@PukarChhatkuli
@PukarChhatkuli 12 күн бұрын
good
@rahulyo.gaming
@rahulyo.gaming 10 күн бұрын
Sorry but actually it is a black board 😂
@quickindiarecipe
@quickindiarecipe 16 күн бұрын
isn't useState also asynchronous?
Become a Master at Reusable Components in React
19:51
Cosden Solutions
Рет қаралды 17 М.
The Most Important Rule for Clean Code in React
16:52
Cosden Solutions
Рет қаралды 26 М.
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
How To Handle Permissions Like A Senior Dev
36:39
Web Dev Simplified
Рет қаралды 290 М.
The Best React Code I Wrote (Code Review)
24:50
Cosden Solutions
Рет қаралды 31 М.
What is Redux? Get A Senior Understanding of How Redux Works
47:45
Server Components in React (Simple Tutorial)
25:27
Cosden Solutions
Рет қаралды 22 М.
Compound Components in React (Design Patterns)
18:21
Cosden Solutions
Рет қаралды 49 М.
7 Design Patterns EVERY Developer Should Know
23:09
ForrestKnight
Рет қаралды 125 М.
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 855 М.
React Router V7 just dropped, here's why you should care
29:11
Theo - t3․gg
Рет қаралды 39 М.
The CSS Display Property is Changing Forever
15:20
Web Dev Simplified
Рет қаралды 71 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 492 М.
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН