0% found this document useful (0 votes)
3 views

REACT - Js Mid-Level Interview Questions

React interview questions
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

REACT - Js Mid-Level Interview Questions

React interview questions
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

React JS

MID-LEVEL INTERVIEW
QUESTIONS AND ANSWERS

Follow for more insights:


MUHAMMAD SALMAN HUSSAIN
MID-LEVEL
QUESTIONS AND ANSWERS
INTERVIEW

1. What is React Router?


Answer: React Router is a standard library for routing in
React, allowing navigation between views and keeping the
UI in sync with the URL.

2. Explain the lifecycle methods of components.


Answer: Components go through stages: Initialization,
Mounting, Updating, and Unmounting.

3. What is `this.setState` in React?


Answer: `setState` updates the state object and re-
renders the component.

4. What are refs in React?


Answer: Refs allow access to DOM elements or React
elements, used to manipulate elements directly.

5. What are hooks in React?


Answer: Hooks enable using state and other React
features without writing classes.

Follow for more insights:


MUHAMMAD SALMAN HUSSAIN
MID-LEVEL
QUESTIONS AND ANSWERS
INTERVIEW

6. Explain the `useState` hook.


Answer: `useState` allows functional components to
manage state.

7. Explain the `useEffect` hook.


Answer: `useEffect` handles side effects, replacing
lifecycle methods like `componentDidUpdate.`

8. What is React Fragments?


Answer: Fragments let you group elements without adding
extra nodes to the DOM.

9. What is React Developer Tools?


Answer: A Chrome extension for debugging React
components, allowing inspection of props, state, hooks, etc.

10. How to use styles in ReactJS?


Answer: CSS modules allow locally scoped styling within
React components.

Follow for more insights:


MUHAMMAD SALMAN HUSSAIN
MID-LEVEL
QUESTIONS AND ANSWERS
INTERVIEW

11. What are styled components?


Answer: Styled components allow writing CSS in
JavaScript, improving modularity and reuse in React.

12. What is prop drilling?


Answer: Prop drilling is passing data through multiple
components unnecessarily when only the last one needs it.

13. What are controlled and uncontrolled


components?
Answer: Controlled components are managed by parent
components, while uncontrolled components manage their
own state.

14. What is `useRef` hook?


Answer: `useRef` creates a reference to DOM elements,
persisting values across renders without causing re-
renders.

15. What are synthetic events in React?


Answer: Synthetic events are React’s wrapper for cross-
browser event handling, improving consistency and
performance.

Follow for more insights:


MUHAMMAD SALMAN HUSSAIN
Download or save
this document for later.

Follow for more insights:


MUHAMMAD SALMAN HUSSAIN

You might also like