News for hackers. Stuff that matters.
Re:When does React re-render? Explaining rerenders and how t... by onion2k on Wednesday April 29, 2020 @05:32AM (#23017194)
From the mithril docs you linked to:

"You should only use onbeforeupdate to skip diffing as a last resort. Avoid using it unless you have a noticeable performance issue."

From the React docs (https://reactjs.org/docs/react-component.html#shouldcomponen...):

"Use shouldComponentUpdate() to let React know if a component’s output is not affected by the current change in state or props. The default behavior is to re-render on every state change, and in the vast majority of cases you should rely on the default behavior. [...] This method only exists as a performance optimization."

Both framework developers are telling users the same thing.

Re:When does React re-render? Explaining rerenders and how t... by jsf01 on Wednesday April 29, 2020 @05:37AM (#23017219)
That’s a good point. There’s something in the difference between the two communities then, where React’s tends to be encouraging of memoized components and shouldComponentUpdate while mithril’s tends to advise against those methods. The blog post behind this thread is a prime example.
Re:When does React re-render? Explaining rerenders and how t... by dragonwriter on Wednesday April 29, 2020 @05:47AM (#23017297)
> There’s something in the difference between the two communities then, where React’s tends to be encouraging of memoized components and shouldComponentUpdate

I haven't seen that.

> The blog post behind this thread is a prime example.

But it's...not at all an example of what you describe. The blog post explains how things work and how to optimize, it doesn't encourage optimizing without demonstrated need, and the "even better" optimization approach it suggests isn't using memoization or shouldComponentUpdate, but instead paying attention to the basic component structure.