Content
@
0 reply
0 recast
0 reaction
Robotandkid
@robotandkid
Good article about React hooks and memory leaks. Basically, your app probably has memory leaks. Doh! https://schiener.io/2024-03-03/react-closures
5 replies
2 recasts
31 reactions
typeof.eth 🔵
@typeof.eth
Good thing to keep in mind for sure, but instantiating that `new BigObject()` on every render is the root cause of that specific issue. Either instantiate once outside the component, or `const bigData = useMemo(() => new BigObject(), [])` and the problem goes away.
1 reply
0 recast
0 reaction
Robotandkid
@robotandkid
of course! playing the devil's advocate, they were just making a point w/ an easy to reason about large object. If you have a large component, you can probably still effectively (accidentally) do the same thing w/ whole bunch of little objects
1 reply
0 recast
1 reaction
typeof.eth 🔵
@typeof.eth
For sure. I wonder if/how this is gonna change once the React compiler is out 🤔
0 reply
0 recast
0 reaction