The React Lifecycle: Simply Explained!

  Рет қаралды 11,398

Cosden Solutions

Cosden Solutions

Күн бұрын

Пікірлер: 37
@edward-vonschondorf-dev
@edward-vonschondorf-dev 10 күн бұрын
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 9 күн бұрын
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.
@andyfoote8117
@andyfoote8117 8 күн бұрын
Great explanation. Useful to see the differences between the client/server implementation being explained.
@ayushdedhia25
@ayushdedhia25 9 күн бұрын
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 🙏🏻
@AjithkumarSekar
@AjithkumarSekar 9 күн бұрын
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
@germain1984
@germain1984 10 күн бұрын
love these types of videos, would be great if you used this format to go thru other concepts
@farzadmf
@farzadmf 9 күн бұрын
Very nice explanation; thank you!
@serdotsenko
@serdotsenko 9 күн бұрын
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 10 күн бұрын
This is the best, I can now answer interview questions better
@BarakAlmog
@BarakAlmog 21 сағат бұрын
Great video. Appreciate your efforts 🙏
@mohamedsalimbensalem6118
@mohamedsalimbensalem6118 10 күн бұрын
Finally, the video that ive been waiting for, Thanks darius for the video ❤
@AlphaTechy
@AlphaTechy 8 күн бұрын
Very nice explanation ❤ , Thanks
@kartikvishwakarma7567
@kartikvishwakarma7567 7 күн бұрын
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 9 күн бұрын
Does React run effect cleanup only after unmounting, or also before each rerun of the actual effect?
@cosdensolutions
@cosdensolutions 9 күн бұрын
Both
@tonyg_nerd
@tonyg_nerd 8 күн бұрын
@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!
@yogeshk4348
@yogeshk4348 10 күн бұрын
Love from INDIA ....
@fitsaleem
@fitsaleem 6 күн бұрын
great cosden
@P.Shivakrishna
@P.Shivakrishna 9 күн бұрын
what about useRef in updating stage how it is act in every state ?
@cosdensolutions
@cosdensolutions 9 күн бұрын
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
@developertools95
@developertools95 9 күн бұрын
u r my bosss
@sjoerdvermeijden
@sjoerdvermeijden 9 күн бұрын
So on every state change the VDOM is re-rendered?
@ali.thecoder
@ali.thecoder 10 күн бұрын
Does this works in react native too ?
@cosdensolutions
@cosdensolutions 10 күн бұрын
yeah, except the server part is still pending
@shahwaizkarim-h9z
@shahwaizkarim-h9z 9 күн бұрын
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 9 күн бұрын
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 5 күн бұрын
@@cosdensolutions Thank you bro for the reply!
@SieanLeon
@SieanLeon 9 күн бұрын
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 9 күн бұрын
check my useEffect tutorial video! it explains it super nicely
@SieanLeon
@SieanLeon 9 күн бұрын
@ 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.
@jamesbotwina8744
@jamesbotwina8744 10 күн бұрын
Why isn't there an option to send you money through KZbin? This is a great video. I'd give you $2.
@cosdensolutions
@cosdensolutions 10 күн бұрын
appreciate the kind words!
@PukarChhatkuli
@PukarChhatkuli 4 күн бұрын
good
@johnforeverrules
@johnforeverrules 10 күн бұрын
first. nice video my man
@rahulyo.gaming
@rahulyo.gaming 2 күн бұрын
Sorry but actually it is a black board 😂
@quickindiarecipe
@quickindiarecipe 8 күн бұрын
isn't useState also asynchronous?
The Most Important Rule for Clean Code in React
16:52
Cosden Solutions
Рет қаралды 23 М.
Learn React Hooks: useCallback - Simply Explained!
17:15
Cosden Solutions
Рет қаралды 108 М.
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 33 МЛН
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 100 МЛН
The CSS Display Property is Changing Forever
15:20
Web Dev Simplified
Рет қаралды 49 М.
7 Design Patterns EVERY Developer Should Know
23:09
ForrestKnight
Рет қаралды 90 М.
Next.js 15.1: Explained!
1:16:46
leerob
Рет қаралды 14 М.
How React Query Won
34:52
Theo - t3․gg
Рет қаралды 87 М.
This Folder Structure Makes Me 100% More Productive
24:36
Web Dev Simplified
Рет қаралды 106 М.
Unintuitive behaviors of React Hooks
16:26
Theo - t3․gg
Рет қаралды 24 М.
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 840 М.
The Most Important Design Pattern in React
35:04
Cosden Solutions
Рет қаралды 112 М.
Server Components in React (Simple Tutorial)
25:27
Cosden Solutions
Рет қаралды 22 М.
Compound Components in React (Design Patterns)
18:21
Cosden Solutions
Рет қаралды 48 М.
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 33 МЛН