the content/explanation of the concepts should be on the site "thinking in react". honestly, this video lets me write my whole app new for performance reasons. great job!
Nadia you're an underrated content creator! You break down concepts clearly both on your blog and here. Am going to dive deeper into all your other articles.
Great perf patterns! I will now think about "Isolate state changes" when adding state to a component! It helps to use more composition and test components more easily.
Enjoying these new patterns of writing. A lot better than other UA-camrs out there suggesting to just 'deal' with the re-renders... Thanks so much for these! 🤙🏾🤙🏾🙏🏽🙏🏽
last week I discovered your blogs and now the vids. Amazing stuffs. I'm building a crypto exchange UI with React and your blogs are helping me a lot. Thank you very much. Keep sharing knowledge.
Thanks for the video, I encountered the first problem with modal (your first example) in a real world project with Material UI modals. The modal component accepts a prop "open" to show it, at first I saw that with a naive approach (useState + modal inside the parent) I'll trigger a re-render on the parent, so first solution, I opted to useRef + forwardRef and I extracted modals as reusable components, then I used a Redux store to save a key+open and dispatch an open/close modal action from the parent with the modal id as key, the modal will have its own id as key and a call to useSelector to see if it's open or not. In fact, extracting as shown in your video was not a solution to make the parent component easy to read.
Absolutely loved the presentation and example. We know these but using this on the fly and for keeping these concepts in mind , such examples really help. Thanks
Wow amazing explanation, I'm going to use this good practice from now on, just to mention all the content I have found out there just tells you to use Memoization but you track the main problem and offer the best solution, Thanks for it and Greetings from Mexico
Thank you VERY much Nadia Makarevich, I was missing some fundamentals on this and your article (and maybe this video is as useful) helped a LOT. It was so clear. Maybe I should have read the official docs from the very beginning I started using React hahaha
Nadia, your content is incredible and I'm glad I found you! I already bought your book and have been enjoying it a lot. Love the way you teach, please keep it up
I really really like your explanation, the time you have put in to make these videos and the cat sticker, it's really cute specially the cat with crown. Wishing you success in getting what you desire.
Thanks for creating such a great video .. From your article, I came here.. Could you please include a separate tab for react hooks in your article .. This would be very helpful to me and other developers.
Great work and thx! One questio if I may? Example with scroll tracking? Is that compontent usefull? How would we fire a callback or some logic without re-render? Updating the state in the wrapper is not usefull for itself, ins't it?
That really depends on what you want to do with that logic, hard to answer without seeing a real-life usecase or code. There are multiple options here, like throttling or exposing that state through render props (if some external component needs access to it without being re-rendered)
@ I’m probably doing mu form wrong but basically the scenario is, every time I input in my input text field, the entire screen re-renders. My form is inside a Modal but idk if that matters.
Thank you so much for explaining these concepts, one question though: passing many components as props at multiple levels wouldn't make it look terrible at the top level? Like some pyramid of code that mabey makes you scroll-x in your code editor to fully see?
It might! 🙂 No silver bullet for anything. Those are just techniques that are useful for certain cases, but over-use of them might result in unreadable code that doesn't make sense
Is there any optimization difference between Component as a children and Component as a prop pattern ? I found both of them to be quite similar in terms of efficiency, as in both the cases the children or the props don't get re-rendered on state updates ? Lovely video BTW 💛
Loved this video! I didn't know props didn't affect changes on the state, thanks so much for going through all possible scenarios we can use in order to avoid unnecessary re-render! Can you also explain on the case where I can useSelector for example: const { trainingMode } = useSelector((state) => state); const { checkedIn } = useSelector((state) => state.checkin); Is there any implications on using only state or state.somethingElse when it comes to re-render?
`useSelector` I assume is something like `reselect` library? Of normal state or React Context it won't matter, re-renders will be triggered at the fact that the state/Context value changes. If you're using Redux or other library, I would need to double check how it behaves, depends on the library
I've jump to codebase that written the code like that at 10:50, and the code is mess and re-rendering like crazy... there is not good way to stop re-rendering in react, unless to slowly started switching to solidjs.
Great video! How would you go about the ButtonWithDialog example if the component had a datagrid in it, and when clicking an item we want to open up the by passing an id. Then it feels like we need to have [id, setId] inside of the component which forces it to rerender? const Component = () => { const [id, setId] = useState(0) const [open, setOpen] = useState(false) const handleItemClick = (id: number) => ( setId(id) setOpen(true) } return (
Yeah, in this case Datagrid will re-render. If it's something you need to prevent, you'd have to either go with React.memo for it, or pass that id through Context/any state management solutions you use
Thank you, I have a question, how can find our components are re-rendered or not? Create a useEffect on them without second entry? What is your way to test and debug when you have no request to an API
This will work. Also, just console.log in render function will be good for it most of the time. And a lot of people like this tool for this: github.com/welldone-software/why-did-you-render
How would you go about preventing rerenders in list generated with Array.map? If the list is passed as a children prop, you end up in a scenario where a prop depends on another prop, ie, , and you can't pass props to props.children in the render code. Nice videos. Thanks
ragarding the last example with column and content. What would you say if Layout still wraps children, and and inside the Layout they are accessed via array destructuring, const [column, content] = children, and then used at appropriate places? I don't see any benefits over 'components as chidren', just wandering if that could be an alternative
For me, that would be confusing - I would understand what the intention is I'd say, but it would take a few seconds from my mental capacity to figure it out. So I'd rather go with some more "traditional" approach. From performance/re-renders perspective it doesn't look like it would bring any benefit either 🤔
the content/explanation of the concepts should be on the site "thinking in react".
honestly, this video lets me write my whole app new for performance reasons. great job!
Nadia you're an underrated content creator! You break down concepts clearly both on your blog and here. Am going to dive deeper into all your other articles.
Thank you, so nice to hear 😊
I never write comments, but this one deserves huge credit for great explanation
Preventing React re-renders with composition
1. Moving state down 1:48
2. Components as children props 4:37
3. Components as props 7:58
Great perf patterns! I will now think about "Isolate state changes" when adding state to a component! It helps to use more composition and test components more easily.
Here after reading your blog.
omg, your videos about react are so didactic that they took away my anxiety of not being able to deal with performance problems, thank you!!
thank you, that's so nice to hear! 😊
Enjoying these new patterns of writing. A lot better than other UA-camrs out there suggesting to just 'deal' with the re-renders... Thanks so much for these! 🤙🏾🤙🏾🙏🏽🙏🏽
last week I discovered your blogs and now the vids. Amazing stuffs. I'm building a crypto exchange UI with React and your blogs are helping me a lot. Thank you very much. Keep sharing knowledge.
talk about boiling things down and getting to the point. thank you for this. amazing.
This is probably the best video about why and how composition reduce re-renders. great stuff!
I read your book, and I truly thank you. Your expertise is incredible. Thanks for sharing all that knowledge.
Watching these videos after reading those long blog posts cements many of the ideas Nadia always talks about. Thank you so much for sharing🙏
Thanks for the video, I encountered the first problem with modal (your first example) in a real world project with Material UI modals. The modal component accepts a prop "open" to show it, at first I saw that with a naive approach (useState + modal inside the parent) I'll trigger a re-render on the parent, so first solution, I opted to useRef + forwardRef and I extracted modals as reusable components, then I used a Redux store to save a key+open and dispatch an open/close modal action from the parent with the modal id as key, the modal will have its own id as key and a call to useSelector to see if it's open or not. In fact, extracting as shown in your video was not a solution to make the parent component easy to read.
Absolutely loved the presentation and example. We know these but using this on the fly and for keeping these concepts in mind , such examples really help. Thanks
Love your way of teaching. Very clear and organized. And sweet animations!
I'm really enjoying your React tutorials! Your explanations are clear and concise, and I'm learning a lot.
Wow amazing explanation, I'm going to use this good practice from now on, just to mention all the content I have found out there just tells you to use Memoization but you track the main problem and offer the best solution, Thanks for it and Greetings from Mexico
Glad you liked it! 😊
Bought your book after watching some of your videos, you explain so well!
Simple and informative performance patterns.
Your content is a treasure, I have read again and again and again your blog, and I have learned a crazy amount of stubs. Thanks a lot!!!
Thank you, glad the blog was useful! 😊
oh wow, this video is pretty new.
explained beautifully and clearly as well. made me re-think everything I have done so far. thank you so much!
Very educative. Keep them coming in
hey nadia, thanks for creating this video.. very straight forward and understandable !
Cheers! Really helpful to have these fundamental patterns explained in one place and so concisely.
Simple and very clear explanation 👌
Thank you VERY much Nadia Makarevich, I was missing some fundamentals on this and your article (and maybe this video is as useful) helped a LOT. It was so clear. Maybe I should have read the official docs from the very beginning I started using React hahaha
Nadia, your content is incredible and I'm glad I found you! I already bought your book and have been enjoying it a lot. Love the way you teach, please keep it up
Thank you! 😊
I really really like your explanation, the time you have put in to make these videos and the cat sticker, it's really cute specially the cat with crown. Wishing you success in getting what you desire.
this content is gold! thanks for such a great detailed explanation on how to properly handle states!
This was quite enlightening as it was refreshing. I think I've leveled up my React Skills in this video. I just subscribed.
Awesome to hear! 😊
this series are making me realize I've been writing some terrible things lol, nice work keep it up!! 🙌
Love your content! Very clear presentation and absolutely amazing! Thank you for your sharing!
Thank you very much Nadia. Very insightful!!
Great video, very helpful. Thanks for sharing!
very clear and concise
Very well explained and concise thank you !!
I just discovered this channel and the content quality is so good. Love your videos :)
Valuable gems, thanks for putting this video and your articles together. Learned some valuable info.
this is a great video - useful, practical, and well-explained
Great video, just keep going. Your material are great source of knowledge both YT and Your website.
wow, you are awesome. One of the best content creators, God gifted explanation skills.
You explain so well, love it 😅
Please provide more videos in any topic on react 🙂Your content is awesome and practical
Wow. So grateful for this video. 🙏
WOw, best way to explain with editing, Keep going on.
This is just what I needed, thank you so much!!
Packed full of valuable content ❤
This was very useful. Thank you!
Great explanation!. You earned a subscriber. I hope your channel experiences steady growth
This content is pure gold
wonder full tutorial mam, i loved your explanation 💌
Thanks so much!!! for your great explanation!
Thanks for creating such a great video .. From your article, I came here.. Could you please include a separate tab for react hooks in your article .. This would be very helpful to me and other developers.
you are really underated creator
Thank you for this amazing video! 🙏🏻🙏🏻
Great work and thx! One questio if I may?
Example with scroll tracking?
Is that compontent usefull? How would we fire a callback or some logic without re-render?
Updating the state in the wrapper is not usefull for itself, ins't it?
That really depends on what you want to do with that logic, hard to answer without seeing a real-life usecase or code. There are multiple options here, like throttling or exposing that state through render props (if some external component needs access to it without being re-rendered)
great video. It really helped! Thank you
Very very helpful! Thanks!
amazing explanation
Thanks, Also we can work in such an MVVM architecture and manage the states on the presenter/controller and consume it in variant components.
great content please make more videos
so cool, thank you for sharing!
Good job! Thanks to the author a lot!
you are so amazing, this video helped me so much
This is very amazing. Thank you so much, big W !!!
Awesome 🎉 this is super crazy and valuable at the same!!
Great video! Thanks!
Great! Very useful info.
Golden content
Thanks! This is awesome!
Thanks! I had so much trouble with re-renders. Can you cover Form re-renders as well?
Do you have anything specific in mind for this?
@ I’m probably doing mu form wrong but basically the scenario is, every time I input in my input text field, the entire screen re-renders.
My form is inside a Modal but idk if that matters.
You just need to trace where you're changing the state - in forms it's no different from other components.
awesome video, thanks for the advice to avoid caveats
Thank you so much for explaining these concepts, one question though: passing many components as props at multiple levels wouldn't make it look terrible at the top level? Like some pyramid of code that mabey makes you scroll-x in your code editor to fully see?
It might! 🙂 No silver bullet for anything. Those are just techniques that are useful for certain cases, but over-use of them might result in unreadable code that doesn't make sense
thanks u @developer way
Nice video, I actually wonder how you make this video with which tools?
With keynote and final cut pro :)
Is there any optimization difference between Component as a children and Component as a prop pattern ? I found both of them to be quite similar in terms of efficiency, as in both the cases the children or the props don't get re-rendered on state updates ? Lovely video BTW 💛
No difference that I know of, children are props, just have nicer jsx "nesting" syntax :)
@@developerwaypatterns That's what I thought too :)
brilliant!
Wow, you're amazing!
Loved this video! I didn't know props didn't affect changes on the state, thanks so much for going through all possible scenarios we can use in order to avoid unnecessary re-render!
Can you also explain on the case where I can useSelector for example:
const { trainingMode } = useSelector((state) => state);
const { checkedIn } = useSelector((state) => state.checkin);
Is there any implications on using only state or state.somethingElse when it comes to re-render?
`useSelector` I assume is something like `reselect` library? Of normal state or React Context it won't matter, re-renders will be triggered at the fact that the state/Context value changes.
If you're using Redux or other library, I would need to double check how it behaves, depends on the library
this is brilliant!
great content! thanks
This is gold 🪙🪙🪙🥇
great video :)
now i am realising why my react project was slow my manger asked me why slow project
very nice, thank you
thanks Nadia
Great job
I've jump to codebase that written the code like that at 10:50, and the code is mess and re-rendering like crazy... there is not good way to stop re-rendering in react, unless to slowly started switching to solidjs.
Great video!
How would you go about the ButtonWithDialog example if the component had a datagrid in it, and when clicking an item we want to open up the by passing an id.
Then it feels like we need to have [id, setId] inside of the component which forces it to rerender?
const Component = () => {
const [id, setId] = useState(0)
const [open, setOpen] = useState(false)
const handleItemClick = (id: number) => (
setId(id)
setOpen(true)
}
return (
{open &&
}
Yeah, in this case Datagrid will re-render. If it's something you need to prevent, you'd have to either go with React.memo for it, or pass that id through Context/any state management solutions you use
Amazing stuff..
Thank you, I have a question, how can find our components are re-rendered or not? Create a useEffect on them without second entry? What is your way to test and debug when you have no request to an API
This will work. Also, just console.log in render function will be good for it most of the time.
And a lot of people like this tool for this: github.com/welldone-software/why-did-you-render
@@developerwaypatterns 🌹♥
How would you go about preventing rerenders in list generated with Array.map? If the list is passed as a children prop, you end up in a scenario where a prop depends on another prop, ie, , and you can't pass props to props.children in the render code. Nice videos. Thanks
ragarding the last example with column and content. What would you say if Layout still wraps children, and and inside the Layout they are accessed via array destructuring, const [column, content] = children, and then used at appropriate places? I don't see any benefits over 'components as chidren', just wandering if that could be an alternative
For me, that would be confusing - I would understand what the intention is I'd say, but it would take a few seconds from my mental capacity to figure it out. So I'd rather go with some more "traditional" approach.
From performance/re-renders perspective it doesn't look like it would bring any benefit either 🤔
Thx a lot!
omg
keep up your work
Thanks ❤❤❤
Interesting content
omg its amazing a diamond video thank u thank u thank u