|
|
|
|
|
by zeorin
322 days ago
|
|
React is easy, once you understand why {} !== {} and that it uses reference equality as a proxy for value equality. This is why the absolute simplest thing to do is to just memoize all the things (see https://attardi.org/why-we-memo-all-the-things/ for a deeper dive into this approach). I know that the conventional wisdom (e.g. https://kentcdodds.com/blog/usememo-and-usecallback) is not to do that, but it's worth noting that Kent doesn't actually bring receipts for his claims, and also the discussion is typically limited to toy examples, not huge applications that have the potential for huge cascading renders when anything changes. In my own profiling of real world applications I have found that memoizing everything is not actually a performance regression. And then also consider the React Compiler, which of course does the same, at an even more fine-grained level than any human could be bothered to consistently do by hand. |
|
This creates a massive gulf between beautiful simple frontend toy examples and the reality of applications made with those same frameworks when deployed for multiple years and product cycles. I think it is a big part of what fuels shiny framework adoption. You think: "yes, this here is what will resolve the complexity and pains I see in my work codebase", and this is bolstered by your carefully curated personal side projects.