KatInterview

Reviewing a Junior's React Component: Feedback and Refactors

BehavioralModel answer
EasyModel answerBehavioralcode-reviewmentoringreact

Last updated

Walk through how you would review a junior engineer's messy React/TypeScript pull request: rank the issues, give feedback that teaches, propose refactors, request tests and plan follow-up.

Scenario

A junior teammate has opened a pull request for a frontend feature. It is a React/TypeScript component that loads data from an API and keeps it in local state. The feature works when you click through it, but the code is hard to read, hard to change and fragile. You are the reviewer.

You may ask clarifying questions about requirements, deadlines and team conventions before you answer.

What to cover

  1. Findings: Which problems would you raise, and in what order? Rank them by impact across correctness, security, performance, accessibility and maintainability. Say which would block the merge.
  2. Delivery: How would you word and structure your comments so the author learns and stays motivated? When would you ask a question, and when would you state the fix outright?
  3. Refactors: Which concrete changes would you suggest for component structure, state management, separation of concerns, naming, typing and error handling?
  4. Tests: What tests would you ask for (unit, integration, end-to-end), and which behaviors should they pin down?
  5. Follow-up: What would you do after the review to help the author improve and to stop the same issues from recurring?

A strong answer shows both technical judgment and the ability to coach.

Hints

Hint 1

Start with a few clarifying questions (urgency, team conventions, what the author understood the requirements to be) because they decide what blocks the merge and what becomes a follow-up.

Hint 2

Sort findings into tiers: security and correctness first (secrets in the client, unsanitized HTML, missing effect dependencies, no error or loading handling, race conditions), then accessibility, then maintainability, and leave style to the linter.

Hint 3

For feedback, label every comment as blocking, should-fix or nit, critique the code rather than the person, ask questions where the reasoning is the lesson, and move to a live pairing session if comments pile up.

Hint 4

Tie each test to a bug you found: a regression test for the stale or racing response, an error-state test, an XSS test, and a role-based query that proves the control is keyboard accessible.