News for hackers. Stuff that matters.
Re:Were React hooks a mistake? by andix on Friday March 10, 2023 @11:07AM (#35096214)
Most of the usecallback or usememo you should try to remove. They are usually there to fix some other rendering issues (mostly performance).

But I also don’t understand, why react renders all child components if the parent renders. As long as their props stay the same, they should just stay as they are.

Re:Were React hooks a mistake? by bluefirebrand on Friday March 10, 2023 @01:14PM (#35098501)
> But I also don’t understand, why react renders all child components if the parent renders. As long as their props stay the same, they should just stay as they are.

It "renders" all child components if their parent renders in order to check if their props have changed or not.

If the component has not actually changed, it does not actually re-draw it.