15 React coding questions worth practicing before your next interview
I put together a list of React problems I kept seeing come up in interview prep β mix of core hooks, a couple of classic "build this component" asks, and a few that companies like Meta/Airbnb/Flipkart actually use. Figured I'd share instead of just keeping the list to myself.
Didn't want to just describe them β you can open each one and actually write + run the code against real tests in the browser, no setup. Links go straight to the problem.
1. Build a counter with three buttons. The classic warm-up β but the interesting part is making sure rapid clicks never lose an update.
2. Delay a value until the user stops typing. You've used this in every search box you've ever built β now write the hook yourself.
- Track what a value used to be, one render ago. Small hook, but people trip over when it actually updates.
- Model a shopping cart's add/remove/update-quantity logic. A good test of whether you reach for useReducer or keep fighting with useState.
- Build a traffic light that cycles red β green β yellow on its own timer. Looks simple until you have to get the timing and cleanup exactly right.
6. Build a search box where slow responses can't overwrite fast ones. This is the one that trips almost everyone up the first time β asked at Airbnb.
7. Render a comment thread with infinite nested replies. Recursion inside JSX β asked at Meta.
8. Stop a long list from re-rendering every item on every keystroke elsewhere on the page. A real performance debugging exercise, not just a memo() one-liner.
9. Give a callback prop a stable identity across renders. Sounds trivial, isn't β especially once a child component is memoized.
10. Build a modal where keyboard focus can't escape it. Accessibility question that separates "I use libraries" from "I understand the DOM."
11. Write a fetch hook that won't re-request data it already has. Basically: build a tiny cache layer from scratch.
12. Manage state for a multi-step form wizard. Back/next/jump-to-step, without the state turning into spaghetti.
13. Build an autocomplete search with keyboard-navigable suggestions. Filtering logic plus a surprisingly fiddly amount of UI state.
14. Add undo/redo to a stateful app. Command-pattern state history β the kind of thing that's easy to describe and annoying to actually implement cleanly.
15. Build a month calendar grid that handles real date math. Leap years, month boundaries, the works β asked at Flipkart.
[link] [comments]