Skip to main content

How To Crack React Interview 2023 - Interview Question

 React Interview Question 2023



React Interview Question 2023:

In this blog, we are going to discuss the best React Interview Question 2023 which are often asked in interviews. 
So why wait, Let's start-

1. What is React Js? 

React js is a javascript library used for developing front end with good speed.
Developers are choosing React js instead of other frameworks because frameworks
come with a fixed package whether you need them or not, 
But in React js we only install the packages we just need. 
Due to this reason react is much lightweight than other frameworks and it has good speed also. 

2. What are the Components in React Js? 

Components are pieces of code that can be reused like functions but components are more powerful than functions. 
It has two types-
  • Class components
  • Functional components

3. What is a class component? 

A component that has ES6 class. 
Class components are more powerful and complex than functional components because of their lifecycle methods and state. 
He we do not need to use Hooks


React Interview Question 2023

4. What is a Functional component? 

A component that has no ES6 class. 
It uses a simple javascript function. 
It is very simple and it needs hooks for performing state and lifecycle methods. 
It is simple to define and it is recommended component. 

5. What is state? 

States are information holders inside components and store data like a variable. 
When we update the state, the component will render again but not in the case of the variable.  

We can not use state outside components. 

6. What are props?

Props are used to share data between components. 
We can share data by from parent to child component or child to parent component or to sibling components. 
We can not change the props in recieving component. 

7. What is hook ? 

 Functional components do not have state and lifecycle method. 
To use state and lifecycle methods in the functional components we need hooks. 
To use hooks we just need to import them and every hook has the prefix 'use' so we can recognize them easily. 

8. What is useState ? 

useState is a hook that is used for states in the functional components. 
Example-
const [ data, setdata ] = React.useState("default value") 

9. What is useEffect ? 

This is a hook used for lifecycle methods in a functional component. 
Example-
React.useEffect(()=> {
  //some work
}) 

Comments