DEV Community

Cover image for Top Interview Questions for Frontend Developers(React)

Top Interview Questions for Frontend Developers(React)

Abhishek Raj on July 30, 2021

In the past few days, I appeared for many frontend devs interview. So, in this post, I have compiled some of the most common question I was asked. ...
Collapse
 
ortonomy profile image
πŸ…–πŸ…‘πŸ…”πŸ…–πŸ…žπŸ…‘πŸ…¨ πŸ…žπŸ…‘πŸ…£πŸ…žπŸ…

Odd interview questions - if I wanted to know how much a developer knew about React I’d be asking more about:

When do you deploy state vs. refs?
What are some gotchas of useEffect?
Under what conditions should you optimise using memo / callback?

For data only components, it’s much more effective these days to export logic out to a hook or render props - there are serious flaws with HoCs…

Collapse
 
sa_webb profile image
Austin Webb

Is there by chance anyway you could provide a brief answer to β€œwhat conditions should you optimize memo / callback?”

I’m a β€œjunior” dev and would like to understand this. The reason why I’m asking is because everything I’ve read online regarding this topic has been more theory than application.

I would greatly appreciate any input that you have to give. Cheers

Collapse
 
ortonomy profile image
πŸ…–πŸ…‘πŸ…”πŸ…–πŸ…žπŸ…‘πŸ…¨ πŸ…žπŸ…‘πŸ…£πŸ…žπŸ…

Sure, I'll write an article on it and link back here.

Collapse
 
abhishekraj272 profile image
Abhishek Raj

Yes those questions can be asked if you are interviewing for intern/junior dev position.
If you are interviewing for senior dev position, more design/optimization questions are asked.

Collapse
 
ortonomy profile image
πŸ…–πŸ…‘πŸ…”πŸ…–πŸ…žπŸ…‘πŸ…¨ πŸ…žπŸ…‘πŸ…£πŸ…žπŸ… • Edited

Depending on the answers to my questions, I know: the above would really show an understanding of how react works and therefore an ability to:

  • know how react decides to re-render (e.g. referential equality)
  • know when & why to use imperative escape hatches over the declarative nature of react
  • know when & why to optimize performance

Subjects I would not really expect a junior/intern to know much about.

Thread Thread
 
abhishekraj272 profile image
Abhishek Raj

Its all about what are requirements of developers in which country.
In my country, even interns are required to know

  1. When to use useState/useRef?
  2. How to use useEffect?
  3. When/How to optimise using memo/callback?
Collapse
 
ortonomy profile image
πŸ…–πŸ…‘πŸ…”πŸ…–πŸ…žπŸ…‘πŸ…¨ πŸ…žπŸ…‘πŸ…£πŸ…žπŸ…

Not really. Nothing you’ve listed is really β€˜senior’

Thread Thread
 
abhishekraj272 profile image
Abhishek Raj

Yes I have only mentioned common react questions, not HLD or LLD questions.

Collapse
 
imalov profile image
Ivan Malov • Edited

Questions like redux vs saga, react vs vue, two way data binding has doesn't make much sense. It seems to me that such questions are asked to specifically fail the candidate or amuse the recruiter's ego. Senior is not about knowledge, but about responsibility and the ability to make decisions. Developer can have not so much experience in Saga, that doesn't make his a bad developer or less "seniory".

If you want to check knowledge and quality, take a look at the code.
If you want to check problem-solving, suggest solving the problem.

Collapse
 
abhishekraj272 profile image
Abhishek Raj
  1. Its Thunk vs Saga not Redux vs Saga and Thunk vs Saga is all about Async/Await and Generator Functions.

  2. No one asked me React vs Vue

  3. This was 1st round there were code review + DSA + HLD + LLD rounds as well

Collapse
 
imalov profile image
Ivan Malov

But this also has doesn't make much sense, as for me. Sorry for repeating, but It seems to me that such questions are asked to specifically fail the candidate or amuse the recruiter’s ego. To confirm this, it is enough to ask a couple of uncomfortable counter questions to the recruiter and you will be surprised how he will fall down.

Again, senior is not about knowledge, he is not a wiki. Senior is about responsibility and the ability to make decisions. And he must also foresee the future a little and set priorities. Where to lay the extensibility, and where not, for example.

Thread Thread
 
abhishekraj272 profile image
Abhishek Raj

Yes, I agree with you.
I would also like to see some counter questions. Could you please throw some light on it.

Thread Thread
 
imalov profile image
Ivan Malov • Edited

Do you mean counter-question to Recruiter? It depends on the situation and your knowledge. There is always something to ask that a person does not know. Once I was asked a lot about Redux. I didn't have much experience with Redux, but I knew something. I thought that the person was really experienced in this matter and asked him about how Redux solves the Diamond Problem. He couldn't say anything about it.

A good technical interview is a dialog between two professionals. You discuss technical topics and understand whether you are suitable for each other or not.

This is my opinion. I understand that there are people for whom this kind of interview, like an exam, is considered normal. But I do not know anyone personally who would be happy to be in the place of the interviewee.

Collapse
 
zannisdf profile image
Giorgio Zanni

IMO getting this kind of questions in an interview for a senior position is a big red flag.

The challenges of building a good frontend go way past the domain of a single library (!) - software architecture, scalability, resilience, testability, asset optimization, separation of concerns, etc. In other words, the fact that you're a react expert doesn't tell anything about your seniority.

Collapse
 
mycarrysun profile image
Mike Harrison

Came here to say this - senior should be able to design systems inside or outside of react and these are pretty beginner questions

Collapse
 
abhishekraj272 profile image
Abhishek Raj

There were multiple rounds after that, this was the 1st one. I have not written about HLD, LLD here

Will make a post in soon.

Collapse
 
mfp22 profile image
Mike Pearson

This is completely irrelevant to the majority of front end development jobs

Collapse
 
abhishekraj272 profile image
Abhishek Raj

React is used nby majority of companies now, thats why more companies are asking React specific question. It might vary from company to country.

Collapse
 
mfp22 profile image
Mike Pearson • Edited

It is the most popular framework for sure, but is it more popular than Angular, Vue, Svelte and others and companies that are hiring front end developers that aren't using a framework at all, combined? Even if React was 80%+ of the entire front end industry, it would be more appropriate to label these as React questions instead of general front end questions.

Thread Thread
 
abhishekraj272 profile image
Abhishek Raj

Last time I checked React was more used than any others.
Lets not make it React vs Angular and discuss its pros & cons. Every framework has that.

Changed the title from frontend to react.

Collapse
 
xavortm profile image
Alex Dimitrov

Oh, you meant React developers

Collapse
 
abhishekraj272 profile image
Abhishek Raj

Last time I read React was considered Frontend πŸ™‚

Collapse
 
xavortm profile image
Alex Dimitrov

So is vue, Angular, VanillaJS, HTML, CSS, SVG, but they were not covered; The (React) in the end, πŸ‘ this works ^^

Collapse
 
deepanshu44 profile image
deepanshu44 • Edited

Does class components and their lifecycle methods hold any importance presently?
Should I study them for interview or functional components and hooks are enough?

Collapse
 
abhishekraj272 profile image
Abhishek Raj

You should know class components & all lifecycle methods and their alternative in hooks, functional components + hooks are important as well.

Reason: My codebases or some part of codebases are still written using class. So, companies sometime ask those question too. Be ready for any question, you don't know what companies are using under the hood.

Cheers :)

Collapse
 
deepanshu44 profile image
deepanshu44

thanks

Collapse
 
ortonomy profile image
πŸ…–πŸ…‘πŸ…”πŸ…–πŸ…žπŸ…‘πŸ…¨ πŸ…žπŸ…‘πŸ…£πŸ…žπŸ…

You should know class-based components - but I would pretty much avoid using them in almost all cases for new code. The only time I know of to use them is without a choice - when you need to implement an Error boundary - the react docs still specify the API as a class component.

Collapse
 
anupamdubey8823 profile image
Anupam Dubey

If the website you are making is not very complex in nature(as in the number of States you have to handle), then using Redux in such cases is not recommended. It is even mentioned on the official Redux documentation page.

Collapse
 
abhishekraj272 profile image
Abhishek Raj

Yes, you are absolutely right, just run away from two way data binding as fast as you can but sometimes it is necessary to use. So, knowing it might be important.

πŸ˜…

Collapse
 
ortonomy profile image
πŸ…–πŸ…‘πŸ…”πŸ…–πŸ…žπŸ…‘πŸ…¨ πŸ…žπŸ…‘πŸ…£πŸ…žπŸ…

Why did you link to a deprecated react API? (For two-way data binding).

Collapse
 
abhishekraj272 profile image
Abhishek Raj

That doc link also has recommended way to do that.

Collapse
 
capscode profile image
capscode

jsut WoW.
1st once is amazing.
thanks

Collapse
 
abhishekraj272 profile image
Abhishek Raj

Thanks for the response Rahul,
I hope you will also like my future posts πŸ˜ƒ

Collapse
 
moniv9 profile image
Mohit Verma

To prepare for frontend/javascript interview. You can look at this ebook I created with collections of commonly asked frontend questions with solution.

mohit8.gumroad.com/l/ygass