For the specific case in codesandbox, memo() doesn't help, The reason is VisualComponent using the key={math.random()} trick, which will alway mount/unmount children component, the author use that trick to force generate new dom node for css animation. Here the modify version that allow memo to work correctly:
14
u/StraightZlat Jan 04 '22
What if the children are wrapped in a memo()