0% found this document useful (0 votes)
8 views1 page

React Qna

Uploaded by

test.shakeb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

React Qna

Uploaded by

test.shakeb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

React Q&A;

Q1: What is React?


A: React is a JavaScript library for building user interfaces, developed by Facebook. It uses a
component-based architecture.

Q2: What are React components?


A: Components are reusable, independent pieces of UI in React. They can be class-based or
functional.

Q3: What is JSX?


A: JSX stands for JavaScript XML. It allows writing HTML-like syntax within JavaScript code.

Q4: Difference between state and props?


A: Props are read-only and passed from parent to child, while state is mutable and managed within
the component.

Q5: What are React hooks?


A: Functions like useState, useEffect, useContext, etc., that allow using state and lifecycle features
in functional components.

Q6: What is the Virtual DOM?


A: A lightweight copy of the real DOM that React uses to optimize UI updates with efficient diffing.

Q7: What is useEffect used for?


A: useEffect manages side effects like data fetching, subscriptions, or manually changing the DOM.

Q8: Difference between controlled and uncontrolled components?


A: Controlled components rely on React state to manage form inputs, while uncontrolled
components use refs and the DOM directly.

Q9: What are higher-order components (HOC)?


A: Functions that take a component and return a new component with additional functionality.

Q10: Write a simple React functional component.


A: function Welcome(props) { return Hello, {[Link]}; } export default Welcome;

You might also like