79134196

Date: 2024-10-28 16:09:03
Score: 1
Natty:
Report link

Try moving your Item definition outside of the ParentComponent definition:

const Item = styled(Paper)({
  textAlign: 'center',
}); 

const ParentComponent = () => { ... }

When you change state inside ParentComponent, it re-runs all the code inside that component. So your "Item" component is getting reinitialized with each state change, forcing its children to re-mount, since it's treated like a whole new component.

Reasons:
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Mitch Withers