Тёмный

Learn to Code: How React.js Works 

Fullstack Academy
Подписаться 58 тыс.
Просмотров 135 тыс.
50% 1

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

 

22 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 75   
@codeisawesome369
@codeisawesome369 5 лет назад
ITT: people shitting on this guy's explanation b/c of a couple mistakes - "MVC React" and "Gandolf" (yikes). The rest of the explanations are actually accurate, super concise, and gave me direction to go look up some extra material which really aided my understanding of how React works under the hood! For the people annoyed about the nervous delivery, just watch on 2x, it's still quite legible.
@albertofunk1167
@albertofunk1167 4 года назад
Loved the BF and DF examples! Really cool, actual CS in practice lol
@lancetakiguchi9756
@lancetakiguchi9756 2 года назад
This was a great explainantion. No one's mentioned that it's just doing a really optimized JSON diff. And that context makes sense with the lifecycle tools. And that last debugging package is great to know. Thank you!
@nitishhardeniya8871
@nitishhardeniya8871 5 лет назад
Just what I was looking for. So summarized explanation on Virtual DOM.
@songlining
@songlining 6 лет назад
This is the best React explanation I have seen, thanks!
@sujanpokharel4627
@sujanpokharel4627 4 года назад
pretty good explanation! I used to think that React is only view, but now believe that internally it is uses MVC. I am satisfied with the explanation.
@sergeymordeev8206
@sergeymordeev8206 6 лет назад
One small remark, O(n) is not an optimization. It is an heuristic based on provided assumption that returns you some sub-optimal solution. Optimization is something different. Optimization is a "hint" to known algorithm to make it faster. For instance, if one would choose using O(n^3) algorithm which really finds the minimal set of changes then optimization could be a hint to this algorithm. However, it will give you the optimal solution. Another example could be Minimax. The result of Minimax does not change if you give it the "hint" of alpha-beta pruning. [Optimization in compiler theory is something different [optimization means here "better solution"], but intuitively it is the same. Compilation result, i.e. machine (or code) should be the same either compiler worked with optimization hints or not (at least in theory). Two produced machines are equivalent regardless of their sizes or execution speed. Compiler returns the optimal solution. That is the equivalent machine to source]. Terms are important because of their meaning. Juggling terms makes you speaking the bird language. Sometime people cease to understand you. Спасибо и удачи. Лайк.
@sasidharreddy7840
@sasidharreddy7840 2 года назад
R u saying O(n3) is the optimal solution....and if we include some extra conditions then we can make up a O(n) sol?
@sergeymordeev8206
@sergeymordeev8206 2 года назад
@@sasidharreddy7840 The short answer is "no". TL; DR; Leave React aside. I will try to explain on fingers... The first thing we have is a "problem". The outcome of it is a "solution". In algo you may have "optimal" and "suboptimal" solutions. "Optimal" in other words means "exact". "Suboptimal" in other words means "good enough for a given problem". The way to the solution is "algorithm". Say, you want to sort some array of strings (names of customers, for example). There will be _only one_ optimal solution for a given input (alphabetically sorted names). You can’t go below n * log(n) [i.e., omega of] in sorting if it is based on comparisons (there is a proof). Nevertheless, you might have an optimization while comparing strings. If within a string you have precalculated value of its hash, in the comparison you might not to go char by char but first to conclude whether they are equivalent or not and only then drop to comparison whether one is greater or less than another. You will save a time if you have a lot of equal strings. The algorithm remains exactly the same! Just some additional info to help it. Now, what if I am saying that most people don’t care about exact sorting in names, and it is enough to have only two (or three) letters of names sorted and about others nobody cares. This is a heuristic. So, can we do better from the time perspective? Oh, yeah! The game has been changed. Now what we can do is to use Bucket sorting. For each two (or three) letter permutations we will have a bucket (say, "aa" -> 0, "ab" -> 1, ..., "zz" -> 26^2 - 1). So, now, it is O(n). In the first step we insert a name to the appropriate bucket which is O(n), in the second step, we will go over the buckets and first and put into the list which is O(n) since the number of buckets do not depend on the input and at most there will be N entries. This is suboptimal but it is good enough for the problem (and much faster in many cases). React trees comparison is different, but it is the same ;-)
@krazybubbler
@krazybubbler 4 года назад
This is just what I needed. Thank You for this great presentation!
@pushkalboganatham5476
@pushkalboganatham5476 6 лет назад
Very informative. Diffing algorithm, React DOM to Browser DOM updation explained very well. React as MVC is wrong.
@AhamedImran
@AhamedImran 7 лет назад
I have rarely heard React called an MVC library. How accurate is this?
@Svsuperstud222
@Svsuperstud222 7 лет назад
Ahamed Imran I believe React is only the 'view' part of the MVC.
@SARCASMOOO
@SARCASMOOO 6 лет назад
would you use react and angular together if you wanted a multi page website?
@dusanjovanov
@dusanjovanov 6 лет назад
No, the library itself,internally is structured as mvc
@vsakaria
@vsakaria 6 лет назад
I agree
@iadityaverma
@iadityaverma 6 лет назад
No, two libraries competing to control and make changes to the DOM is a bad idea.
@rravithejareddy9026
@rravithejareddy9026 7 лет назад
In depth, Perfect , Technical
@laurelineparis5407
@laurelineparis5407 3 года назад
I've been looking for talk like this for a while, thanks for sharing this very intuitive explanation !! Hope to find more ( I'm gonna explore your talks :) )
@rajdeepchandra9807
@rajdeepchandra9807 5 лет назад
Very informative video man. Loved the way you showcased the perf tools implementation
@mohitkumaris
@mohitkumaris 3 года назад
React isn’t an MVC framework. React is a library for building composable user interfaces. It encourages the creation of reusable UI components which present data that changes over time.
@mrkevinlui
@mrkevinlui 2 года назад
If you zoom into the details of React, it can be broken down into MVC tiers and that makes sense. I think your idea of MVC might be the traditional 3-tier app of V being client, C being middletier, and model being the database.
@ninjaturtle11754
@ninjaturtle11754 6 лет назад
he so nervous, it makes me nervous, but the explanation of what React does with the DOM and Virtual DOM is pretty well done. The diffing is explained in a pretty straightforward fashion.
@ozkaa
@ozkaa 4 года назад
he wasnt even that nervous, he did a great job. don't be a jerk all your life bro
@ninjaturtle11754
@ninjaturtle11754 4 года назад
ozkaa he sounds nervous, just a fact, I am not a jerk all my life, thanks for the advice
@sanjivchavan7685
@sanjivchavan7685 7 лет назад
Why we not directly update the updated nodes in browser DOM rather than creating virtual DOM n comparing it again with browser DOM??
@XCSme
@XCSme 6 лет назад
sanjiv chavan Because every change to the DOM will trigger a reflow as he mentioned which is really slow. You want to make all your changes at once and also you want to minimize the number of changes that you make. He also mentioned that even reeading from the actual DOM might trigger a reflow, so you might trigger the reflow during the diffing phase.
@sanjivchavan7685
@sanjivchavan7685 6 лет назад
Thanks.
@geekcubiclesl8834
@geekcubiclesl8834 3 года назад
good explanation.Thank you
@prateeksharma1047
@prateeksharma1047 7 лет назад
Really Informative video for a beginner like me.
@cristef
@cristef 3 года назад
This is gold, man ! Thank you !
@SSchithFoo
@SSchithFoo 6 лет назад
Its not an MVC architecture based library. It uses Flux architecture with one directional dataflow.
@pushkalboganatham5476
@pushkalboganatham5476 6 лет назад
Can you please provide the references for the Browser DOM update slide.
@adamkenton2585
@adamkenton2585 6 лет назад
Did he really wrote "Gandolf" (2:01)
@asdfasdfuhf
@asdfasdfuhf 6 лет назад
Did you really write "wrote" instead of "write"?
@stopPlannedObsolescence
@stopPlannedObsolescence 5 лет назад
"wrote"
@liquidgoldCN
@liquidgoldCN 7 лет назад
Great content, thankyou!
@fullStackInKannada
@fullStackInKannada 3 года назад
Nice!
@damonwu9658
@damonwu9658 5 лет назад
Good stuff, thanks
@ranesh237
@ranesh237 5 лет назад
A virtual DOM is created "completely from scratch" every time 2:40? I thought that a "new" tree is created only when the root elements are not of the same type (eg. span and div)
@rajniprakash6418
@rajniprakash6418 4 года назад
Where does Virtual DOM store in React?
@SanjayKrishnaA
@SanjayKrishnaA 4 года назад
rajni prakash ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-NEcWgDcGYoQ.html in this video you have your answe
@nayeem9236
@nayeem9236 7 лет назад
Awesome information!
@notyournormaldev1419
@notyournormaldev1419 2 года назад
Intro seems wrong
@kduisheev4355
@kduisheev4355 3 года назад
Great speech, though. But React is not an MVC
@DeViLTh0rn
@DeViLTh0rn 3 года назад
Basicly react is papaDOM 🥴
@Tunispy
@Tunispy 5 лет назад
React isn’t an MVC -____-
@mattmarkus4868
@mattmarkus4868 5 лет назад
I thought React is just UI (views).
@vladimirlazarevic4255
@vladimirlazarevic4255 3 года назад
React isnt MVC!
@abdulmateen9037
@abdulmateen9037 5 лет назад
MVC and react what the hell
@HenriZava
@HenriZava 7 лет назад
I cringed hard when you said React was MVC, sorry, brah... you lost me there
@Ukr123
@Ukr123 6 лет назад
oh yes, me too.
@dazzaondmic
@dazzaondmic 6 лет назад
What he meant was that the library itself is structured as MVC. He did not meant that React is used to build MVC apps.
@ergusto
@ergusto 6 лет назад
Then you completely misinterpreted what he was saying...
@battlefieldtroopersEA
@battlefieldtroopersEA 4 года назад
Boy he's getting nervous
@Fahad-zv9rr
@Fahad-zv9rr 7 лет назад
he seems nervous voice is cracking maybe he needs react for his MVC model lol!
@alterego3110
@alterego3110 5 лет назад
That is probably the most stupid explanation of MVC I have ever heard. What makes me sad is that is “academy” which supposed to teach new devs who doesn’t yet have a bs filter.
@vojtechno0452
@vojtechno0452 5 лет назад
I believe that he was talking about how the library is structured itselft. "react is whats called a model-view-controller, it's the architecture of the library. What that really means that it splits up the controll of whole process into three components." That are his words and after that he is talking about model as core of react where is the virtual DOM built. Maybe I misunderstood it, can you explain me why is this the most stupid explanation? I don't know, but if you would look on react as single application you see that MVC desing pattern can be applied or seen in this structure. I'm relatively new in this, so your answer could help me a lot.
@relaxandnostress3625
@relaxandnostress3625 5 лет назад
10 minutes of wasting time for nothing. Couple of hours to do almost nothing. This is React.
@fullstackacademy8400
@fullstackacademy8400 4 года назад
This a very well explained insightful of how react manages vdom to optimism dom re rendering
Далее
How React ACTUALLY works (DEEP DIVE 2023)
12:59
Просмотров 63 тыс.
Understanding React's UI Rendering Process
29:07
Просмотров 217 тыс.
DIY Pump Solutions
00:18
Просмотров 1,5 млн
Tech Talk: What is the Virtual DOM?
9:30
Просмотров 47 тыс.
React Component Patterns 
by Michael Chan
15:12
Просмотров 72 тыс.
If __name__ == "__main__" for Python Developers
8:47
Просмотров 409 тыс.
How a React App Works Under the Hood
14:18
Просмотров 58 тыс.
How Does React Actually Work? React.js Deep Dive #1
15:25
The Unreasonable Effectiveness Of Plain Text
14:37
Просмотров 609 тыс.
JavaScript Pro Tips - Code This, NOT That
12:37
Просмотров 2,5 млн