d/reactjsAahmadAug 9, 2026
Why does my component remount every time the parent re-renders?

I keep hitting a case where a child component loses its local state on every parent render. The docs mention keys, but it feels like there's a deeper rule about element identity I'm missing. What mental model do you use to predict when React will preserve or destroy a component instance?

7
0 comments

Comments (0)