Very detailed explanation. Well done, man! You cover so many of the lesser covered topics that are integral in understanding what's happening "Under-the-hood". Much appreciated
Just WooW, the amount of information I have learned is tremendous, you're really a good teacher I like the way you explain the lessons with, please keep it up I wish I knew you a long time ago.
your series is much more than a tutorial. it is a lecture series that include tutorials. Your teaching style far exceed anything on RU-vid in techniqcal training. i had to come here to understand the motivation for pure components as well as what shallow comparison is
PureComponent - renders only if there is a Shallow change b/w values Regular component - always renders. 1. Shallow comparison : primitive - just value; complex - references. 2. if parent has pureComponent - then child also will not rerender.......
At 10:20, why don't we see re render in parent component? Its clearly see that prevState is not equal to this.state because both points to different reference. We are not comparing values for objects as per shallow comparison? Please explain.
I am confused on setState react will call the render method only if it has any change in the state but here it keeps set the name as vishwas then how it call render method again and again please clarify
Hello sir. Sir in pure and regular component you have not accessed props like previous videos. In previous videos you used render(props){ Bla bla... } But here you used render(){ Bla bla... }. So, is it correct syntax you used in this video?
very clear explanation. thank you so much for that. i have a doubt that even it support performance boost, why cant we use pure components only instead of components
Well, I did not get the last part. :-( Is it like, we should not make changes in the state by changing /adding/ removing the data in the state object? instead, we should return a brand new object and as a new state? Please, anyone!
Basically create a new array with the elements instead of pushing the element in the original array. If you mutate the original array, in pure components re-rendering will not take place.
In pure comonents when rerendering, it will not check if the values in for example your array have changed. It will check if the object refrence is still the same. If it is it wont rerender. But it your create and populate a new object with your values. It will change and rerender the component
I got now what exactly is pure and how it improves performance , one question i have in mind , if i add shouldcomponentupdate to regular component , will it be converted to PureComponent?
good series for lazy guy like me, 4th day on react and this always bring me back since you almost covered all do's and donts on every section just amazing thanks
i didn;t understand shallow comparison, we are not say that `setState` return new state? hence new reference even if properties is the same, then Pure Component should re-render when we calling setState whenever.
Thank you for such wonderful content. Here, in Regular Component, if we write a shouldComponentupdate method with shallow comparison of props/state, would that make it equivalent to Pure Component?
Hi sir, you explained all most all of the react topics in class components not in functional components. Now a days all the companies are using functional components. Let me know pure components can use in functional components.
How solve this error? Warning: PureComponent(...): No `render` method found on the returned component instance: you may have forgotten to define `render`.
I'm still not clear. Why wouldn't we use pure components rather than regular ones all the time? When is it advantageous to use a regular one rather than a pure one?
From what I understand, if you want to have control over the rerender of the component you use PureComponent, if you want it to rerender no matter what, you use regular components. Basically you avoid the component to rerender when you dont want it to, which boosts performance when using PureComponents.
Even I did change Value of name in this.setstate(){ name: 'Hassan"} Instead of Vishvas ,still the result is same why? means pure component is not printing in console ,?