Top 30 Salesforce Agentforce Prompt Builder Interview Questions & Answers
Thirty Salesforce Agentforce Prompt Builder interview questions — prompt templates, grounding, merge fields, flows and Apex — with clear answers.
Thirty React interview questions with clear answers — JSX, components, props, state, hooks, virtual DOM and performance — for freshers and experienced.
React continues to be one of the most popular JavaScript libraries for building modern web applications. From startups to large enterprises, React is widely used to create fast, scalable, and interactive user interfaces. Due to its massive adoption, React developers remain in high demand across the industry.
Whether you are preparing for your first frontend developer interview or aiming for a senior React developer role, having a strong understanding of React fundamentals and advanced concepts is essential. Interviewers often assess your knowledge of components, hooks, state management, routing, performance optimization, and modern React development practices.
This comprehensive guide covers the Top 30 React Interview Questions and Answers that are frequently asked in technical interviews. Each question includes clear explanations and practical examples to help you strengthen your React concepts and boost your interview confidence.
React is an open-source JavaScript library developed by Facebook for building user interfaces, particularly single-page applications (SPAs). It follows a component-based architecture that allows developers to create reusable UI components and efficiently update the user interface whenever data changes.
React uses a Virtual DOM to improve performance by updating only the necessary parts of the webpage instead of reloading the entire page.
React is a declarative, component-based JavaScript library used for building fast and interactive user interfaces.
| Reason | Benefit |
|---|---|
| High Industry Demand | Used by thousands of companies worldwide |
| Strong Ecosystem | Huge collection of libraries and tools |
| Excellent Performance | Virtual DOM improves rendering speed |
| Reusable Components | Faster development and easier maintenance |
| Cross Platform Development | React Native enables mobile app development |
| Large Community | Extensive documentation and support |
| Feature | Description |
|---|---|
| Library Type | Frontend JavaScript Library |
| Developed By | Meta (Facebook) |
| Architecture | Component-Based |
| Language | JavaScript / TypeScript |
| Rendering | Virtual DOM |
| State Management | State, Context API, Redux |
| Routing | React Router |
| Latest Trend | React 19, Server Components, Actions |
Part 1: React Fundamentals (Q1–Q10)
Part 2: Hooks, Routing & State Management (Q11–Q20)
Part 3: Advanced React (Q21–Q30)
Don't memorize answers blindly. Focus on understanding the concepts and practice implementing them in small projects. Most interviewers prefer practical understanding over theoretical definitions.
Let's begin with the most commonly asked React fundamental interview questions that every React developer should know.
React Basics, JSX, Components, Props, State, Virtual DOM and more.
Answer
React is an open-source JavaScript library developed by Facebook (Meta) for building fast, interactive, and reusable user interfaces. It follows a component-based architecture, allowing developers to create complex applications using small reusable UI components.
React uses a Virtual DOM to improve performance by updating only the parts of the webpage that have changed instead of reloading the entire page.
React is a UI library, not a complete framework.
Example
function App() {
return <h1>Hello React!</h1>;
}
export default App;
Answer
React offers several powerful features that make frontend development easier and faster.
| Feature | Description |
|---|---|
| Component-Based | Build UI using reusable components |
| Virtual DOM | Improves application performance |
| JSX | Write HTML inside JavaScript |
| One-Way Data Binding | Predictable data flow |
| Hooks | Manage state and lifecycle in functional components |
| Fast Rendering | Updates only changed elements |
Virtual DOM and Component-Based Architecture are among the most frequently asked React concepts.
Answer
Virtual DOM is a lightweight copy of the actual DOM maintained by React in memory.
Whenever state or props change:
This process is known as Reconciliation.
Faster rendering and improved performance.
Flow
State Change
↓
Virtual DOM Updated
↓
Diffing Algorithm
↓
Real DOM Updated
Answer
| Feature | React | Angular |
|---|---|---|
| Type | Library | Framework |
| Language | JavaScript | TypeScript |
| DOM | Virtual DOM | Real DOM |
| Learning Curve | Easier | Steeper |
| Performance | Fast | Good |
| State Management | Redux, Context API | Built-in Services |
React is lightweight and flexible, while Angular is a complete frontend framework.
Answer
JSX (JavaScript XML) is a syntax extension that allows developers to write HTML-like code inside JavaScript.
JSX makes React code easier to read and understand.
JSX Example
const element = <h1>Welcome to React</h1>;
Equivalent JavaScript
const element = React.createElement(
"h1",
null,
"Welcome to React"
);
Browsers cannot understand JSX directly. Babel converts JSX into JavaScript.
Answer
Components are reusable building blocks of a React application. Each component represents a part of the user interface.
React applications are created by combining multiple components.
Example
function Header() {
return <h2>LearnFrenzy</h2>;
}
export default Header;
The Header component can be reused anywhere in the application.
Reusability, maintainability, and cleaner code structure.
Answer
| Functional Component | Class Component |
|---|---|
| Simple JavaScript function | ES6 Class |
| Uses Hooks | Uses Lifecycle Methods |
| Less code | More boilerplate |
| Preferred in modern React | Rarely used today |
Functional Component
function Welcome() {
return <h1>Hello User</h1>;
}
Class Component
class Welcome extends React.Component {
render() {
return <h1>Hello User</h1>;
}
}
Answer
Props (Properties) are used to pass data from a parent component to a child component.
Props are read-only and cannot be modified by the child component.
Example
function Welcome(props) {
return <h2>Hello {props.name}</h2>;
}
function App() {
return <Welcome name="Saurabh" />;
}
Output
Hello Saurabh
Props enable communication between components.
Answer
State is a built-in object used to store dynamic data within a component.
Whenever state changes, React automatically re-renders the component.
Example
import { useState } from "react";
function Counter() {
const [count, setCount] = useState(0);
return (
<div>
<p>Count: {count}</p>
<button
onClick={() => setCount(count + 1)}
>
Increment
</button>
</div>
);
}
Internal component data that can change over time.
Answer
React follows One-Way Data Binding, meaning data flows only from parent components to child components through props.
This makes applications more predictable and easier to debug.
Example
function Child(props) {
return <p>{props.message}</p>;
}
function Parent() {
return (
<Child message="Hello React" />
);
}
Data Flow
Parent Component
↓
Props
↓
Child Component
One-way data flow helps maintain predictable application behavior and improves debugging.
React Hooks, useState, useEffect, useRef, useMemo, Routing, Context API, Redux and more.
Answer
The useState() Hook allows functional components to manage and update state. It was introduced in React 16.8 and eliminated the need for class components for state management.
Syntax
const [state, setState] = useState(initialValue);
Example
import { useState } from "react";
function Counter() {
const [count, setCount] = useState(0);
return (
<div>
<h3>Count: {count}</h3>
<button
onClick={() => setCount(count + 1)}
>
Increment
</button>
</div>
);
}
useState returns an array containing the current state value and a function to update it.
Answer
The useEffect() Hook is used for handling side effects such as API calls, subscriptions, timers, and DOM manipulation.
It works similarly to lifecycle methods in class components.
Example
import { useEffect } from "react";
function App() {
useEffect(() => {
console.log("Component Loaded");
}, []);
return <h2>LearnFrenzy</h2>;
}
Dependency Array Examples
| Syntax | Behavior |
|---|---|
| useEffect(() => {}) | Runs after every render |
| useEffect(() => {}, []) | Runs only once |
| useEffect(() => {}, [count]) | Runs when count changes |
Answer
The useRef() Hook creates a mutable reference that persists across renders without causing component re-rendering.
Common Uses
Example
import { useRef } from "react";
function App() {
const inputRef = useRef();
const focusInput = () => {
inputRef.current.focus();
};
return (
<>
<input ref={inputRef} />
<button onClick={focusInput}>
Focus
</button>
</>
);
}
Updating useRef does not trigger re-rendering.
Answer
The useMemo() Hook is used to memoize expensive calculations and improve application performance.
React recalculates the value only when dependencies change.
Example
import { useMemo } from "react";
function App({ num }) {
const square = useMemo(() => {
return num * num;
}, [num]);
return <h2>{square}</h2>;
}
Heavy computations, filtering large datasets, sorting operations.
Answer
The useCallback() Hook memoizes functions and prevents unnecessary recreation of functions during re-renders.
Example
import { useCallback } from "react";
function App() {
const handleClick = useCallback(() => {
console.log("Button Clicked");
}, []);
return (
<button onClick={handleClick}>
Click Me
</button>
);
}
| Hook | Purpose |
|---|---|
| useMemo | Memoizes values |
| useCallback | Memoizes functions |
Answer
React Router is a popular library used for navigation and routing in React applications.
It enables Single Page Applications (SPAs) to switch between pages without refreshing the browser.
Example
import {
BrowserRouter,
Routes,
Route
} from "react-router-dom";
function App() {
return (
<BrowserRouter>
<Routes>
<Route
path="/"
element={<Home />}
/>
<Route
path="/about"
element={<About />}
/>
</Routes>
</BrowserRouter>
);
}
BrowserRouter, Routes, Route, Link, NavLink, Navigate.
Answer
Controlled Components are form elements whose values are managed by React state.
Example
import { useState } from "react";
function App() {
const [name, setName] = useState("");
return (
<input
value={name}
onChange={(e) =>
setName(e.target.value)
}
/>
);
}
React controls the input value completely.
Answer
Uncontrolled Components manage their own state internally using the DOM instead of React state.
Example
import { useRef } from "react";
function App() {
const inputRef = useRef();
const showValue = () => {
alert(inputRef.current.value);
};
return (
<>
<input ref={inputRef} />
<button onClick={showValue}>
Submit
</button>
</>
);
}
| Controlled | Uncontrolled |
|---|---|
| Managed by React State | Managed by DOM |
| More Predictable | Simpler for small forms |
| Preferred in React Apps | Less Common |
Answer
Context API provides a way to share data across components without passing props manually through every level.
It helps avoid Prop Drilling.
Create Context
import { createContext } from "react";
export const UserContext =
createContext();
Provider Example
<UserContext.Provider
value="LearnFrenzy"
>
<App />
</UserContext.Provider>
Consume Context
import { useContext } from "react";
const user =
useContext(UserContext);
Theme settings, authentication, user preferences, language settings.
Answer
Both Redux and Context API are used for state management, but they serve different purposes.
| Feature | Context API | Redux |
|---|---|---|
| Built Into React | Yes | No |
| Learning Curve | Easy | Moderate |
| Performance | Good | Excellent |
| Complex State | Limited | Ideal |
| Middleware Support | No | Yes |
| Large Applications | Less Suitable | Highly Suitable |
Use Context API for small-to-medium applications and Redux for large applications with complex state management requirements.
React Suspense, Lazy Loading, Code Splitting, Custom Hooks, HOC, SSR, Next.js, React 19 Features and Performance Optimization.
Answer
React Suspense is a built-in feature that allows components to "wait" for something before rendering, such as lazy-loaded components, API responses, or asynchronous data.
Instead of showing a blank screen while content loads, Suspense displays a fallback UI such as a loader or spinner.
Example
import React, {
Suspense,
lazy
} from "react";
const Dashboard = lazy(() =>
import("./Dashboard")
);
function App() {
return (
<Suspense
fallback={<h3>Loading...</h3>}
>
<Dashboard />
</Suspense>
);
}
Code splitting, lazy loading, and improving user experience during loading states.
Answer
Lazy Loading is a performance optimization technique where components are loaded only when they are required instead of loading everything at application startup.
This reduces the initial bundle size and improves page load speed.
Example
import { lazy } from "react";
const Profile = lazy(() =>
import("./Profile")
);
| Without Lazy Loading | With Lazy Loading |
|---|---|
| Entire application loads initially | Only required components load |
| Larger bundle size | Smaller bundle size |
| Slower startup | Faster startup |
Answer
Code Splitting is the process of dividing an application's code into smaller chunks that can be loaded on demand.
React commonly uses code splitting together with React.lazy() and Suspense.
Benefits
Example
const AboutPage = React.lazy(() =>
import("./AboutPage")
);
Lazy Loading is implemented using Code Splitting.
Answer
Error Boundaries are React components that catch JavaScript errors in their child component tree and display a fallback UI instead of crashing the entire application.
They only work in Class Components.
Example
class ErrorBoundary
extends React.Component {
constructor(props) {
super(props);
this.state = {
hasError: false
};
}
static getDerivedStateFromError() {
return {
hasError: true
};
}
render() {
if (this.state.hasError) {
return <h2>
Something went wrong
</h2>;
}
return this.props.children;
}
}
Error Boundaries do not catch errors inside event handlers or asynchronous code.
Answer
Custom Hooks allow developers to extract reusable logic from components and use it across multiple parts of an application.
A Custom Hook is simply a JavaScript function whose name starts with use.
Example
import { useState } from "react";
function useCounter() {
const [count, setCount] =
useState(0);
const increment = () =>
setCount(count + 1);
return {
count,
increment
};
}
Usage
const {
count,
increment
} = useCounter();
Reusable logic without duplicating code.
Answer
A Higher Order Component (HOC) is a function that takes a component as input and returns a new enhanced component.
HOCs are used for sharing reusable functionality across components.
Example
function withLogger(
WrappedComponent
) {
return function(props) {
console.log("Rendered");
return (
<WrappedComponent
{...props}
/>
);
};
}
Usage
const EnhancedComponent =
withLogger(MyComponent);
Custom Hooks are generally preferred over HOCs in modern React applications.
Answer
Server-Side Rendering (SSR) is the process of rendering React components on the server before sending HTML to the browser.
Unlike traditional React applications where rendering happens in the browser, SSR generates HTML on the server.
Benefits
| CSR | SSR |
|---|---|
| Rendered in Browser | Rendered on Server |
| Slower First Load | Faster First Load |
| SEO Challenges | SEO Friendly |
Answer
Next.js is a React framework that provides additional features such as SSR, Static Site Generation (SSG), API Routes, Image Optimization, and File-Based Routing.
| React | Next.js |
|---|---|
| UI Library | Full Framework |
| Manual Routing | File-Based Routing |
| No SSR by Default | Built-in SSR |
| No API Routes | Built-in API Routes |
| Client Side Rendering | SSR + SSG + CSR |
Many modern React applications are now built using Next.js instead of plain React.
Answer
React 19 introduced several improvements focused on developer productivity and application performance.
Major Features
React 19 interview questions are becoming increasingly common for senior frontend roles.
Answer
Performance optimization is an important topic in React interviews, especially for experienced developers.
React.memo Example
const UserCard = React.memo(
function UserCard(props) {
return (
<h2>
{props.name}
</h2>
);
}
);
Mention useMemo, useCallback, React.memo, Lazy Loading, and Code Splitting as the primary optimization techniques.
React remains one of the most sought-after frontend technologies in 2026. Whether you're preparing for a Frontend Developer, React Developer, Full Stack Developer, or Software Engineer interview, mastering these React interview questions will significantly improve your confidence and technical understanding.
Focus on understanding the concepts rather than memorizing answers. Interviewers often ask follow-up questions based on your explanations, so practical experience and project-based learning are equally important.
Practice building React projects, solve coding challenges, and explore advanced topics like Next.js, TypeScript, Server Components, and Micro Frontends to become a highly skilled React developer.
These Top 30 React Interview Questions and Answers cover everything from React fundamentals to advanced concepts such as Hooks, Routing, Context API, SSR, Next.js, React 19 features, and performance optimization. Reviewing these questions regularly and applying them in real projects will help you crack React interviews with confidence and build modern, scalable web applications.
Master React, Angular, Node.js, JavaScript, System Design, and Full Stack Development with interview-focused content and practical examples.
One short email when we publish something new — interview questions, Salesforce guides and career tips. No spam, unsubscribe in one click.
Thirty Salesforce Agentforce Prompt Builder interview questions — prompt templates, grounding, merge fields, flows and Apex — with clear answers.
30 Salesforce Agentforce interview questions with answers — AI agents, topics, actions, Einstein Trust Layer and Data Cloud — for freshers and experienced.
Thirty Salesforce LWC interview questions with answers — decorators, lifecycle, events, wire, Apex, LDS and testing — for freshers and experienced developers.
Questions, corrections or your own experience — they all help the next reader.