Seems like your comment cut off there, but if you're using class components in React, there will be repeated code, yes, which is why hooks were invented and why they enable you to reuse such code.
I’m referring to the dependency array you pass into hooks, and any hook being able to trigger updates.
With classes there was no manual dependency tracking (except comparing old props?) and all re-renders were triggered by state, context or prop changes.
Not making a judgement either way, just stating the trade-offs.
The dependency array strikes me as far safer and more reliable, but it has been a bit of a foot gun for a lot of people. I still encounter code where dependencies are missing, which virtually never makes sense or should be intentional. I suppose the compilation step that’s proposed would address that, but it’s yet to be seen.
There does seem to be an aspect to modern react where it’s great if you’re willing to put in the effort to figure out all the quirks, but for everyone else who just wants to get things done/has other priorities, it’s a bit of a minefield at times.