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.