Top 10 interview questions and answers for senior React engineers
I've been involved in senior React developer role interviews numerous times and from both sides of the table. As a candidate, I’ve learned that many things I thought were important to recruiters aren’t, and as a recruiter, I learned to ask questions which would let me find a candidate that I would want to work with as a peer.
This is by no means a comprehensive guide to interviewing as a senior React developer, nor it is a knowledge library that will give you exact answers and explanations. (there are plenty of good React resources and courses on the Web) In your interviews, you may get asked some of the questions below, or none at all, but if you come prepared, you will have knowledge and confidence to talk easily about most of the topics that an interviewer may cover.
1. Describe what happens when you type a URL in the browser and press enter
This is a question a like to start my interviews and a surprising number of candidates struggles with it. It’s important to me because it lets the candidate go as deeply as they want when they answer it. Things they omit from the answer are also pretty revealing. For instance, will the candidate begin by talking about DNS and explain how it works? Will they describe the order in which the assets are being loaded by the browser? Do they understand the difference between
<script> tag placed in the document head and at the end of the body? Will they mention HTTP/2?
This question has no single, right answer but if you’re asked about this topic, take your time to go through the whole flow. You probably won’t need to go into details about the OSI model, but it’s important to show understanding of underlying networking technology and protocols.
I may prompt the candidate to talk about prototypal inheritance and if they have no idea what that is (because all they know are ES6/TypeScript classes) then it’s an immediate red flag.
In most cases, the discussion turns into object-oriented programming and its characteristics. I may ask general questions like what polymorphism is or what the difference between a class and an object is. It’s usually apparent if the developer really knows what they’re talking about.
3. Describe three designs patterns you know
Another general software engineering question you may get asked about would be some variant of this one. I often get asked about particular design patterns (usually ones that are being used in the project I’m being interviewed for) but personally, I like to keep it quite generic. What I’m interested in is whether you know any design patterns, whether you can actually talk about them and understand how they can be implemented. (not just the theory that you can read before the interview)
Senior developers will have opinions which I may not agree with, and it’s okay! Being able to comfortably discuss engineering topics with an interviewer is not just a sign of an experienced candidate, but also of a potential good culture fit.
4. What is the difference between a heap and a stack?
malloc the memory manually fortunately!
The minimum here is being able to say what the memory heap and call stack are.
5. What is the React component lifecycle?
6. What is virtual DOM, and how does it work?
Virtual DOM is one of the fundamental concepts in React, so you will be expected to understand how it works. Can you explain what performance impact it has and why? Do you know what the difference between virtual DOM and shadow DOM is? What is reconciliation? If you also mention React Fiber, it will score you additional points and signal to the interviewer that you keep up-to-date with the latest changes to internal framework architecture.
A good starting point for reading about React internal is in the official documentation.
7. What is the difference between useMemo() and React.memo()?
This question can be a good prompt to talk about several topics: React hooks, pure components and memoization. Every senior-level React engineer should have at least some experience with memoization. If they don’t, then it raises more questions about their knowledge of performance optimization.
If the discussion turns into hooks in general, be ready to talk about any of them:
useLayoutEffect, etc. and what the differences are.
Knowing general caching concepts won’t hurt either!
8. What is Redux?
I have yet to participate in an interview (on either side) which doesn’t involve asking the developer about Redux and state management in React. Here’s a few tips on crushing that answer:
- talk about unidirectional data flow
- if you usually use auxiliary utilities like
redux-toolkit, build a project without them to be able to talk comfortable about reducers, dispatching actions, middleware and enhancers
- know at least one side effect library (e.g.
redux-saga) and understand what the use-cases are
9. How would you test your React components?
I can assure you there’s going to be at least one question about testing in a senior React engineer interview. A developer that doesn’t test their code will usually get rejected, no matter what their knowledge in other areas is. You may have your opinions about test-driven development (I know I do!) or the benefits (or lack thereof) of end-to-end testing in web applications, but you need to demonstrate the experience in unit testing, knowledge of arrange-act-assert test structure, snapshot testing, spies, mocks and stubs.
You may also get asked more generic questions, like what the benefits of unit tests are.
10. What is the difference between React and AngularJS/Angular/Vue?
If you mentioned any other frameworks (either on your CV or during the interview) be prepared to be able to talk about differences between those. As a candidate, I’ve always liked this open-ended question because it lets me show the breadth of my experience as a developer. It also allows you to touch the topics you’re most comfortable with. Do you have in-depth knowledge about change detection in Angular? Talk about it and explain how it’s different in React. Do you know internals of template compilation in Vue? Show off your knowledge and compare to JSX.
If you search for “React interview questions” on Google you will get hundreds or thousands of results that contain dozens or hundreds of example questions each. There’s so much noise that these won’t really help you prepare to your interview. Instead, I tried to distill the topics down to just 10, based on my experience in this industry.
At the end of the day, even as a senior engineer it’s impossible to know every little internal detail of all the technologies we work with on a daily basis. That’s why it’s much more important to be able to talk comfortably about higher-level concepts, while getting into deeper details on some of them.
And if you use this article as a reference before the interview, and you get the offer afterwards, let me know!