DEV Community

Cover image for React JS Interview(Part-2)
Atul Bhatt
Atul Bhatt

Posted on

React JS Interview(Part-2)

So this is the second blog post where I'm sharing some more important questions that you may stumble upon while giving a React JS or just a JS interview. Even if you don't encounter any of these questions in your interview it will be good to check them out just for finding out how many of them you know well. Let's start.

  • What is a pure function?
  • What is a HOC?
  • Give some examples of HOC you have used.
  • What is render props?
  • Custom Hooks?
  • Difference between Custom Hooks and Functions and Component?
  • Explain the working of Virtual DOM in detail.
  • What is reconciliation in react?
  • What are controlled and Uncontrolled components?
  • Which one is better-controlled or uncontrolled components?
  • What is Memoization and how it can be achieved in React?
  • Do you know what is a toolchain?
  • What is code splitting in React and how we can achieve it?
  • What is hoisting in JavaScript?
  • What is the difference between Array.forEach() and Array.map()?
  • Explain event loop?
  • Name one JS engine.
  • Is Javascript Object Oriented? If not then what type it is?

Some JS snippets to try:

Snippet1

let a = [1,2,3,4,5]
let b = a
b[3] = 10
let c = b
console.log(a,b,c)
//Output: ??
Enter fullscreen mode Exit fullscreen mode
Snippet2


let obj1= {name:"atul", age:24, 
           hobbies:['reading books', 
           'writing blogs','exercising', 'poetry']}
let obj2 = obj1
delete obj2['hobbies']
console.log(obj1, obj2)
Enter fullscreen mode Exit fullscreen mode
Snippet3


const aa  = 5
const bb = [12,23,543,56]
const cc = {name: "atul", age:24}
ac= 10 //What will happen? Is this Ok.
bb[3] = 9
bb[4] = 12
cc['Age'] = 'greater than 18'
Enter fullscreen mode Exit fullscreen mode
Snippet4


let myself = {
  name: "atul",
  age: 24,
  hobbies: ["reading books", "writing blogs", "exercising", "poetry"],
  favourites: {
    movies: ["Iron Man", "End Game", "Spiderman"],
    Sports: ["Cricket", "Football", "Basketball", "Badminton"],
    song: ["Legends Never Die", "Chidiya: Vilen", "etc", "etc..."]
  }
};

let yourself = { ...myself };
yourself["hobbies"] = ["Guitar playing", "playing football", "Dancing"];

let newSelf = {
  ...myself
};
newSelf.favourites.movies = ["Star Wars", "Ice Age", "Batman", "Flash"];

console.log("myself:", myself);
console.log("yourself:", yourself);
console.log("newself", newSelf);
Enter fullscreen mode Exit fullscreen mode

Here is link to all the questions asked above with implementation, so that you don't feel slacking off with what will happen in each case.

I will be ending this article here for now. I'll continue it in the next part with more questions that will cover more in-depth questions. So see you around here next time.👋
Have an insightful day 😄.

Oldest comments (4)

Collapse
 
lukeshiru profile image
Luke Shiru

Even if you don't encounter any of these questions in your interview it will be good to check them out just for finding out how many of them you know well

You'll encounter none of these questions in a serious interview. Every now and then a post like this appears in my feed, and is always the same:

  • Questions that you can Google, with no real value for the interviewer or the candidate. These kind of questions look like taken from a React/JS exam, instead of an interview.
  • Targeted to "juniors/novices" when generally the person that wrote the article is a "junior/novice" themsef.
  • No sources listed for the questions, like real interviews, or stats, or whatever.

Serious software companies don't care if you know the definition of HOC, they care about you knowing how to use one, if you have used them in the past, if you keep using them or you know that they are useless nowadays, and so on. Same applies for pretty much every question listed here.

Please, before writing articles like "X interview questions", make sure you know about "X", that you actually did a lot of interviews about it (either as a candidate or as an interviewer), and then, just then, consider start creating posts like this one -_-

Cheers

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

Thank you for your response. These indeed are beginner level questions. And you're right these can be googled too. But to be honest these are some questions I have myself faced during interview and I've got to know from others who faced them too.

Yes, these are targeted to Juniors indeed to check if they know these concepts.

And it would be great to get a link to some resource that has some serious interview questions. It'll be helpful for me and others who come across this article. That indeed will be a nice treat for them.

And always Thank you for your valuable response. Still learning 😃

Collapse
 
prakashpaarthipan profile image
Prakash_DevOps

Thank you, I'm new for React .Its Very helpful.

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

I'm glad that it was helpful to you.