Things you didn't know about re-rendering in React

  Рет қаралды 42,446

Code Sketched

Code Sketched

Күн бұрын

Пікірлер
@as_if
@as_if 9 ай бұрын
3 reasons re rendering happens - change of state value - change of props value - re rendering of parent/grandparent components (for the impurity (side effect) of a component) Rendering itself is a well optimised method thanks to reconciliation. Moreover- 3rd reason can be avoided by using exporting default React.memo(component);
@KeshariPiyush24
@KeshariPiyush24 25 күн бұрын
Also in case of class components we can extend React.PureComponent instead of React.Component to make our class component PURE.
@as_if
@as_if 25 күн бұрын
@KeshariPiyush24 acha, I haven't studied about class components.
@lasue7244
@lasue7244 21 күн бұрын
In this very video, it's explained that props changes doesn't rerender a component.
@as_if
@as_if 21 күн бұрын
@@lasue7244 huh, nah, see 3:50. It has to
@ziaahmad8738
@ziaahmad8738 Жыл бұрын
Nice video. I see you linked Josh Comeau's article. I have also subscribed to his newsletter. Good stuff.
@QuantumVoid-ro3hi
@QuantumVoid-ro3hi 10 ай бұрын
So what's the bottom line? That any component that doesn't depend on state OUTSIDE itself (apart from what's passed in through its props) is a candidate to be memeoized (including components that have internal state)?
@razakadegoke3340
@razakadegoke3340 10 ай бұрын
Very well explained thx for your video
@Monishreddy-l2k
@Monishreddy-l2k 5 ай бұрын
Amazinggg explanation man
@PrajaktaBhapkar-v8i
@PrajaktaBhapkar-v8i Жыл бұрын
great explanation,alldoubts are clear,Thanks
@dailyPractice1
@dailyPractice1 2 ай бұрын
In my today's interview, Interviewer gave me same scenario question and asked if child component will re-render or not.
@amys6175
@amys6175 Жыл бұрын
This is very useful, thank you so much
@georgeem9954
@georgeem9954 Жыл бұрын
Excellent Explaination
@nikhilfromyoutube
@nikhilfromyoutube Жыл бұрын
Good Explanation! I would like to you many video like this further.. ; )
@aayushxhhetri1344
@aayushxhhetri1344 6 ай бұрын
lets say i have a const currentTime = new Date() below the count state and i try to render it Current Time: {currentTime.toLocaleTimeString()} in place of testcomponent ... then when i click the increament button the date also updates and shows the current date and time at the moment the button is clicked ..now you said that it wont happen because of virtual dom and it only renders the elements that is being updated but here this is no the case.. Can you explain why???
@Someguy-vl7dj
@Someguy-vl7dj 6 ай бұрын
He said it won't happen because if the virtual dom doesn't change, it doesn't send any change to the dom, but in your case, the virtual dom changed because "currentTime.toLocaleTimeString()" returned a different value.
@thuannguyenlehoa9711
@thuannguyenlehoa9711 Жыл бұрын
when state change, the component whose state will be flagged -> React will go down through the Component to find the component flagged and update the Component tree -> JSX convert React Element -> new VirtualDom -> new VirtualDom diff old Virtual DOM -> actual DOM, right? but when will the component be flagged? ( when call setter function)
@saifullahkhan3776
@saifullahkhan3776 Жыл бұрын
What an explanation!!!!! By the way you speak English so fluently
@CodeSketched
@CodeSketched Жыл бұрын
Thanks a lot. Please check out the latest video. You will like that one too.
@croccante7676
@croccante7676 Жыл бұрын
great explanation, thank you very much
@as_if
@as_if 9 ай бұрын
Thank you sir
@thecatleo
@thecatleo Жыл бұрын
u should have wrapped the Testcomponent in the React.memo for the example . since it doesnt receive any props but rerendner under a parent component. why u did u spoilt the video at end..
@astronautischilling
@astronautischilling Жыл бұрын
ok + 1 subscribe, great explanation
@CodeSketched
@CodeSketched Жыл бұрын
Thanks a lot. Please share the video :)
The important things to know about React state and renders
18:33
Web Dev Cody
Рет қаралды 28 М.
Preventing React re-renders with composition
12:11
Developer Way
Рет қаралды 23 М.
You might not need useEffect() ...
21:45
Academind
Рет қаралды 177 М.
Must Know React Concepts As A React Developer
13:04
Coding Mastery
Рет қаралды 3 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 493 М.
The problem with useEffect
11:37
Cosden Solutions
Рет қаралды 36 М.
Why React components re-render?
13:30
Developer Way
Рет қаралды 14 М.
This is the Only Right Way to Write React clean-code - SOLID
18:23
Junior vs Senior React Folder Structure - How To Organize React Projects
16:16
Why React had to create a whole new markup language?
4:03
Code Sketched
Рет қаралды 3,3 М.