1. React is mainly used for developing ______.
React focuses on building interactive user interfaces for web and mobile apps. It doesn't handle databases or backend logic.
Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
React · Question Set
React Basics interview questions for placements and exams.
Questions
19
Included in this set
Subject
React
Explore more sets
Difficulty
Mixed
Level of this set
Go through each question and its explanation. Use this set as a focused practice pack for React.
React focuses on building interactive user interfaces for web and mobile apps. It doesn't handle databases or backend logic.
For complete preparation, combine this set with full subject-wise practice for React. You can also explore other subjects and sets from the links below.
Every React class component must implement a render() method that returns the component’s UI.
React is fast thanks to Virtual DOM, SEO-friendly with server-side rendering, easy to learn, allows reusable components, and provides great developer tools. Its component model also promotes clean, maintainable code.
ReactDOM.render() mounts or updates React elements into the DOM. It connects your React app to a real HTML container, typically linking JavaScript logic to browser display.
ReactDOM.render(<App />, document.getElementById('root'));JSX stands for JavaScript XML. It allows developers to write HTML-like syntax inside JavaScript, making UI creation easier and more readable. React converts JSX into standard JavaScript using React.createElement() calls.
const element = <h1>Hello, React!</h1>;
// Compiles to: React.createElement('h1', null, 'Hello, React!');Props (short for properties) are inputs passed from parent to child components. They are read-only and used to send data or event handlers into components.
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}In React, data flows in one direction — from parent to child through props. This predictable flow makes debugging and state management simpler.
React is a component-based JavaScript library for building reusable UI elements and handling user interface logic efficiently.
React is only a library, not a full framework. It requires learning JSX and other tools like routing or state management separately. Beginners might find it complex due to the large ecosystem.
Main features include the use of Virtual DOM for performance, component-based architecture for reusability, one-way data flow for predictability, and JSX for writing UI with HTML-like syntax inside JavaScript.
Yes, React can be written without JSX by using React.createElement() directly. JSX is just a syntax sugar that makes code easier to read but not mandatory.
const element = React.createElement('h1', null, 'Hello React without JSX');The Real DOM updates the UI directly and is slow for frequent changes. The Virtual DOM is a lightweight copy stored in memory that React updates first, and only the differences are applied to the real DOM, making it much faster.
React keeps two versions of the Virtual DOM—previous and current. When a change occurs, React compares them (diffing) and updates only the changed parts in the real DOM, making rendering fast and efficient.
Keys are unique identifiers for elements in a list. They help React know which items have changed, been added, or removed, improving rendering efficiency and preventing re-rendering errors.
const list = items.map(item => <li key={item.id}>{item.name}</li>);Keys should be used when rendering lists of elements. Without them, React cannot track item changes properly, leading to wrong re-renders or performance issues.
Props are external and passed to components; they can’t be modified inside. State is internal data managed within a component using hooks like useState(). Props are for communication, while state is for managing local changes.
Keys must be unique only among siblings in a list, not globally. They help React track which list items change during rendering.
React is an open-source JavaScript library developed by Facebook (now Meta) for building user interfaces, especially single-page applications. It helps developers create reusable UI components that update efficiently when data changes.
React is one of the most popular front-end libraries today. It has a large developer community, strong ecosystem, and is widely used in production by companies like Facebook, Instagram, and Airbnb. Its simple learning curve and reusable components make it ideal for fast-growing projects.