3 ms·
The auto-memoization is: 1) Trading memory pressure for performance 2) An admission of a broken model because it's taken them 2+ (almost 3?) years to build as
by CharlieDigital 2y ago
The auto-memoization is:
1) Trading memory pressure for performance
2) An admission of a broken model because it's taken them 2+ (almost 3?) years to build as a recognition that developers can't get it right
The reason other frameworks don't need this is because they use signals connected to callbacks instead of the reactive callback pointing to the component (as React does). Thus Preact, Solid, Svelte, Vue, etc. do not have this issue and you rarely (if ever?) have to manually memoize.
The React team foot-gunned themselves and every React dev out there.
I have some examples that walk through this concept using JSFiddle so you can understand exactly why this design choice from React created this problem in the first place: https://chrlschn.dev/blog/2025/01/the-inverted-reactivity-model-of-react/ https://chrlschn.dev/blog/2025/01/the-inverted-reactivity-mo...