DEV Community

Passionate Coder
Passionate Coder

Posted on • Updated on

React Interview Questions

1) What is React?
Ans :

  1. React is an open-source frontend JavaScript library.
  2. Used for building user interfaces especially for single page applications.
  3. It is used to handle presentation layer for web and mobile apps.
  4. It was developed by Facebook in 2011.

2) What is JSX in react?
Ans :

  1. JSX stands for JavaScript XML.
  2. JSX allows us to write HTML elements in JavaScript

3) What is component in react?
Ans :

  1. Components are main building block of react.
  2. Components are independent and reusable bits of code.

image

4) What are props in react?
Ans:

  1. Props are properties of a component.
  2. Props are read only/ Immutable
  3. Makes component dynamic
  4. Data can be shared with the help of props.
  5. Props are arguments passed into React components.

image

5) What is Fragments in React?
Ans :

A common pattern in React is for a component to return multiple elements. Fragments let you group a list of children without adding extra nodes to the DOM.

image

6) What are defaultProps in React?
Ans:

defaultProps is a property in React component used to set default values for the props argument. It will be changed if the prop property is passed.

image

7) What is props.children in react?
Ans :
props.children represents the content between the opening and the closing tags when

8) What is Lifting State Up in React?
Ans :
In React, sharing state is accomplished by moving it up to the closest common ancestor of the components that need it. This is called “lifting state up”.

9) Why fragments are better than container divs?
Ans :

1) Reduces un-necessary adding of elements in DOM.
2) Helps to keep html elements structure like in table

If you like you can visit my YouTube videos

10) What is reconciliation?
Ans :

Reconciliation is the process through which React updates the DOM.

Top comments (1)

Collapse
 
filatovv profile image
Yuri Filatov

very good!!!