DEV Community

Cover image for 10 common React Js interview questions.

10 common React Js interview questions.

Mafuzur Rahman on September 21, 2023

What is React.js, and what are its key features? Answer: React is an open-source JavaScript library for building user interfaces. Its key features...
Collapse
 
barrymichaeldoyle profile image
Barry Michael Doyle

I value the content you've shared, but I'm uncertain if companies would really ask these specific questions since they seem quite theoretical and might not reflect a candidate's practical React experience.

Moreover, there's an inconsistency in your post. When discussing "Explain the difference between functional components and class components in React," you noted that functional components are stateless. However, in your later section on "Explain React Hooks", you bring up useState. It's key to note that useState provides state to a component, and it's only for functional components.

In fact the only question that I can really imagine being asked here is the last one about prop drilling, that is a good question for someone applying for a junior role.

Collapse
 
mahfuzurrahman01 profile image
Mafuzur Rahman

Thank you so much for sharing your opinions. I've just mentioned 10 questions that I've faced as a ** junior Frontend role** at the time of the first screening session in some of my recent interviews. After the first screening, I had to face some coding tasks where I needed to prove how much I knew about the react ecosystem.

And the second thing is You're absolutely correct, and I appreciate your keen observation. I apologize for any confusion. Functional components in React can indeed manage state using hooks like useState, which contradicts the earlier statement that functional components are stateless. React Hooks, such as useState, useEffect, and others, have allowed functional components to handle state and side effects, blurring the line between functional and class components.

To clarify:

Functional components can manage state using hooks like useState.
Class components can manage state using this.state.

React Hooks have made it possible for functional components to have local component state, which was traditionally a feature of class components. Thank you for pointing out the inconsistency, and I hope this clarification helps.

Collapse
 
sakthivela0567 profile image
sakthi_l_u_c_i

Can u post more questions? I'm preparing for an interview I seem to bit lost about where to or what to prepare for the interview. if u can share your experience it'll be helpful.

Thread Thread
 
mahfuzurrahman01 profile image
Mafuzur Rahman

Thank you so much, Sakthi.
I'll upload a new post about React JS interview questions soon.
Also thinking about sharing a post where I'll talk about how I got my first job as a junior front-end developer

Thread Thread
 
sakthivela0567 profile image
sakthi_l_u_c_i

That'll be helpful

Collapse
 
jaybek profile image
Julian Bektashi

Really? They seem pretty basic questions to me.

Collapse
 
barrymichaeldoyle profile image
Barry Michael Doyle

I didn’t say they weren’t basic πŸ˜… They’re basic theoretical questions, nothing that actually says you have any experience writing code to solve problems.

Thread Thread
 
jaybek profile image
Julian Bektashi • Edited

I see. Sorry, I saw this first when I woke up.

To be honest, all this kind of school-like questions seem kinda stupid to me. Makes much more sense going through a portfolio project and explain the hows and whys. It show many things at once: the programming proficiency, the knowledge about the technologies used, the problem solving skills, and presentation skills too. Whatever, things rarely make sense in the labor market. 🫠

Thread Thread
 
barrymichaeldoyle profile image
Barry Michael Doyle

I 100% agree with this!

I see far too many people entering the developer market focusing on the wrong things and then they wonder why they can't set themselves apart when searching for a decent job in the market.

I think I was a bit too diplomatic in my original reply to this article. These school like questions are going to get people nowhere...

Thread Thread
 
jaybek profile image
Julian Bektashi

It's kinda ironic, as I am saying this while I have't landed my first interview yet, for an embarrassingly long time! IπŸ˜…

Thread Thread
 
mahfuzurrahman01 profile image
Mafuzur Rahman

However many organizations nowadays ask some basic and theoretical questions on their first screening session. And I was also facing those theoretical questions that's why I wrote this article.

Thread Thread
 
mardiya profile image
Mardiya Zubairu

These questions might be basic theory but I think they would give the interviewer an insight into the basic understanding of the react eco system that the candidate has. You might not give such a textbook sounding reply but Responding to this in your own words possibly with examples demonstrating the nuances can help the interviewer know if you understand what you’re working with. It’s like someone using a useEffect hook for data fetching because it was learnt in tutorials and now muscle memory. Explaining the concept of the effect would make them realise they had limited knowledge of it.

Thread Thread
 
mahfuzurrahman01 profile image
Mafuzur Rahman

Yes I agree with that when you explain any of them you must know that how it works and also give an example will help the interviewer to understand that you know how to and where to use it.

Thread Thread
 
barrymichaeldoyle profile image
Barry Michael Doyle

Where and how do you use the virtual dom?