DEV Community

loading...
Cover image for React Interview Questions

React Interview Questions

Full Stack Tutorials
Full Stack Developer (JavaScript, MERN Stack, PHP, Python, SQL etc). Author@fullstacktutorials.com - Learn Free Online Tutorials
・Updated on ・2 min read

React.js Interview Questions and Answers

Q:- What is React.js?

React js is an open-source JavaScript library created by Facebook for building complex and interactive UI in web and mobile applications.

Q:- What are the features of React.js?

Major features of React are listed below:

  1. Virtual DOM: It uses the Virtual DOM instead of the real DOM.
  2. Server-Side Rendering: It uses Server-side rendering (SSR).
  3. Uni-Directional: It follows Uni-directional data flow or data binding.
  4. Components: It uses reusable UI components.

Q:- How to Install React.js using Create React App?

Step-1: First, install react app creator.

For Windows:

npm install -g create-react-app

For Linux and Mac:

sudo npm install -g create-react-app

Step-2: Now, create a your project using react app.

create-react-app myFirstReactProject

Step-3: Now, go to the project folder & start the your app/project.

cd myFirstReactProject
npm start

Q:- What are props in React?

props are immutable passed into react components.

Q:- What is state in React?

State of a component is an object that holds some information that may change over the lifetime of the component.

Changing the state Object:

use this.setState() method to change the state.
Whenever you will change the state, the component will be re-render.

Important Tips:

Never use this.setState() method inside the render.
If you will use this.setState() inside componentWillUnmount(), component will not be re-render.

Q:- What are Components?

Components let you split the UI into independent, reusable pieces, and think about each piece in isolation.

There are mainly two types of Components:

  1. Functional Component (Stateless Component) - Only props, no state
  2. Class Component (Stateful Component) - Both props and state.

Q:- What is Reconciliation?

Reconciliation is the process through which React updates the DOM.

Read the Complete Article React.js Interview Questions & Answers

Discussion (2)

Collapse
chadalen profile image
Chad Alen • Edited

Q:- What are props in React?

Your answer is very weak. Props stand for properties. In a nutshell it’s just a way to pass properties into react components.

Collapse
fullstacktuts profile image
Full Stack Tutorials Author • Edited

Thanks for your valuable comment! here is just short info, will take care of such things while posting any links. complete info about props is provided here...

Read the Complete Article React.js Interview Questions & Answers