Incrementally, and only where it buys something. Classes and function components interoperate fine, so there is no need for a big bang rewrite. Convert leaf components first, extract shared logic from higher order components and render props into custom hooks, and keep error boundaries as classes since they still have to be. Tie each conversion to work you are already doing, with tests around behavior rather than implementation.
Why interviewers ask this
This is a judgment question dressed as a migration question. The interviewer wants to see whether you would burn a quarter on a rewrite with no user visible benefit or find an incremental path. They are also checking practical knowledge: which lifecycle methods map cleanly to effects, which do not, and that error boundaries cannot be converted, plus how you avoid regressions without full coverage.
How to structure your answer
- Reject the big bang rewrite and say why incremental works here.
- Give your ordering: leaves first, shared logic into custom hooks.
- Name the pieces that do not convert cleanly.
- Explain how you protect against regressions and measure progress.
Example answer
I would not do it as a project, I would do it as a habit. Classes and function components sit side by side happily, so there is no forcing function to convert everything, and a rewrite with no user facing change is a hard sell and a great way to introduce bugs. So the rule becomes: if you are already changing a file, and it is a leaf or near leaf, convert it. The real prize is not the components anyway, it is the shared logic trapped in higher order components and render props, because that turns into custom hooks that everything can use. On the mapping, componentDidMount and componentWillUnmount go to one effect with a cleanup, componentDidUpdate usually splits into several effects by concern, and getDerivedStateFromProps almost always turns out to be derived state that should just be calculated during render. Error boundaries stay as classes, that has not changed. Before converting anything non trivial I want behavior level tests around it, testing what the user sees rather than internal state, so the conversion is provably neutral.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- Which lifecycle methods have no clean hook equivalent?
- How would you convert a higher order component that wraps forty screens?
- How do you keep the team from half migrating and stalling?
Related react developer questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions