
For 5+ year roles, interviewers stop asking about syntax. They ask about architecture, data flow, reliability and trade-offs. This set covers what comes up in senior and lead frontend rounds: error handling, hydration, server state, state management, security, testing and the newer React 19 APIs.
How to practise: read each question and tap the option you think is correct. You will see right away whether you got it, along with a short explanation, and your score is tracked at the bottom of the screen. This set has 16 questions.
Topics covered in this set
- Error boundaries and hydration errors
- Server state vs client state
- Redux Toolkit and external stores
- Security with dangerouslySetInnerHTML
- Testing Library philosophy
- Portals, compound components, React 19 APIs and Core Web Vitals
React MCQs with answers and explanations
Q1. Which errors does a React error boundary catch?
a) Errors in setTimeout callbacks
b) Errors thrown while rendering, in lifecycle methods and in constructors of the components below it
c) Errors in event handlers
d) Errors in the error boundary itself
Q2. What commonly causes a hydration mismatch warning?
a) Using too many components
b) Rendering values that differ between server and client, such as Date.now(), Math.random() or typeof window checks
c) Using CSS modules
d) Using TypeScript
Q3. Why do teams use TanStack Query (React Query) instead of storing API responses in Redux by hand?
a) It only works with GraphQL
b) It makes API calls synchronous
c) It manages server state for you: caching, deduplication, background refetching, retries and stale data
d) It replaces React
Q4. In Redux Toolkit's createSlice, why can reducers be written as if they mutate state, for example state.count += 1?
a) The store is cloned on every action
b) It uses Immer, which records the changes and produces a new immutable state
c) Redux Toolkit allows mutation of the store
d) Mutation is only allowed in development
Q5. Which of these is NOT a reasonable way to deal with prop drilling?
a) Copying the same state into every component that needs it
b) React context for widely used values
c) Component composition (passing components as children)
d) A state library such as Zustand or Redux
Q6. Which statement about XSS in React is correct?
a) React never escapes strings
b) dangerouslySetInnerHTML is always safe
c) React escapes values rendered in JSX, but dangerouslySetInnerHTML with untrusted HTML can lead to XSS unless it is sanitised
d) XSS is impossible in single-page apps
Q7. Which practice follows the React Testing Library approach?
a) Testing a component's internal state directly
b) Calling component methods directly
c) Querying elements by role, label or text the way a user would, and asserting on visible behaviour
d) Snapshot-testing every component
Q8. What does a React portal do?
a) Loads a remote component
b) Shares state between apps
c) Creates an iframe
d) Renders children into a DOM node outside the parent's DOM hierarchy while keeping them in the React tree
Q9. How is ref handling different for function components in React 19?
a) Refs must be strings
b) Function components can receive ref as a regular prop, so forwardRef is no longer needed for new code
c) Refs are removed
d) Refs only work with class components
Q10. Why does React Hook Form often re-render less than a form built with useState for each field?
a) It registers mostly uncontrolled inputs and reads their values through refs, so typing does not re-render the whole form
b) It disables validation
c) It caches the DOM
d) It uses class components
Q11. What is Module Federation mainly used for?
a) Compressing images
b) Server-side rendering
c) Type checking
d) Loading modules from separately built and deployed applications at runtime, often for micro-frontends
Q12. A <Tabs> component exposes <Tabs.List>, <Tabs.Tab> and <Tabs.Panel>, which coordinate through a shared context. Which pattern is this?
a) Compound components
b) Singleton
c) Higher-order component
d) Render props
Q13. What problem does useSyncExternalStore solve?
a) Safely subscribing to an external store so all components see a consistent snapshot during concurrent rendering (no tearing)
b) Replacing useState
c) Syncing localStorage between tabs automatically
d) Fetching data
Q14. Which Core Web Vital measures how quickly a page responds to user interactions?
a) LCP (Largest Contentful Paint)
b) INP (Interaction to Next Paint)
c) TTFB (Time to First Byte)
d) CLS (Cumulative Layout Shift)
Q15. Which React 19 hook lets you show an updated UI immediately while an async action is still in progress?
a) useDebugValue
b) useImperativeHandle
c) useOptimistic
d) useInsertionEffect
Q16. A component stores fullName in state and updates it in an effect whenever firstName or lastName change. What is the better approach?
a) Calculate fullName during render from firstName and lastName
b) Add more effects
c) Use a global store
d) Store it in a ref
Quick revision notes
- Error boundaries catch only errors during render. Handle event-handler and async errors yourself.
- Hydration needs the first client render to match the server HTML.
- Keep server state in a data library and client state in local state, context or a small store.
- Never pass untrusted HTML to dangerouslySetInnerHTML without sanitising it.
- Test behaviour the way users see it. Calculate derived values instead of syncing them with effects.
Frequently asked questions
What do interviewers expect from a 5+ year React developer?
Clear thinking about architecture and trade-offs. That means state management choices, performance, rendering strategies (CSR, SSR, SSG, RSC), testing, accessibility, security, and how you lead code quality in a team.
Is Redux still relevant?
Yes, especially Redux Toolkit for large apps with complex client state. Many teams now pair a server-state library with a lighter store like Zustand. So knowing the trade-offs matters more than knowing one tool.
How should I prepare for a senior frontend system design round?
Practise designing features from start to finish: component structure, data flow, caching, error and loading states, performance budgets, accessibility, and how you would test and monitor it.
Comments
Post a Comment