Interview Q&A

Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.

4616 total questions 4516 technical 100 career & HR 4346 from PDF library

Showing 1–25 of 36

Career & HR topics

By tech stack

Junior PDF
What is React and why would you use it? React is a JavaScript library for building user interfaces, mainly for single-page

pplications. It helps developers create reusable UI components, manage state efficiently, nd update the UI in a performant way. ✅ Why use React? Easy to break UIs into components Efficient updates with Virtual DOM Rich e…

React Read answer
Junior PDF
Define routes using the <Route /> component:

Answer: function Home() { return &amp;lt;h1&amp;gt;Home Page&amp;lt;/h1&amp;gt;; } function About() { return &amp;lt;h1&amp;gt;About Page&amp;lt;/h1&amp;gt;; } What interviewers expect A clear definition tied to React in…

React Read answer
Junior PDF
What is JSX? Can browsers read JSX directly?

JSX stands for JavaScript XML. It lets you write HTML-like syntax in JavaScript. const element = &lt;h1&gt;Hello, world!&lt;/h1&gt;; 🚫 No, browsers cannot read JSX directly. JSX needs to be transpiled (e.g., using Babel…

React Read answer
Junior PDF
What is the Virtual DOM and how does React use it?

The Virtual DOM is a lightweight in-memory representation of the real DOM. React updates the Virtual DOM first and compares it with the previous version, only applying the necessary changes to the real DOM. ✅ Benefit: Im…

React Read answer
Junior PDF
What is state in React?

State is data that is local to a component and can change over time. ✅ Example using useState: import { useState } from 'react'; function Counter() { const [count, setCount] = useState(0); return &lt;button onClick={() =…

React Read answer
Junior PDF
What is the difference between state and props?

Answer: Feature Props State Mutable? ❌ No (read-only) ✅ Yes Who sets it? Parent component Component itself Used for Passing data Handling internal data What interviewers expect A clear definition tied to React in React.j…

React Read answer
Junior PDF
What is the purpose of keys in React lists?

Answer: Keys help React identify which items have changed, been added, or removed. ✅ Example: {items.map(item =&amp;gt; ( &amp;lt;li key={item.id}&amp;gt;{item.name}&amp;lt;/li&amp;gt; ))} 🛑 Avoid using array index as k…

React Read answer
Junior PDF
What is the difference between controlled and uncontrolled components? Feature Controlled Uncontrolled Input value managed by React state DOM itself

Answer: ccess value via useState ref Example use case Forms with validation Quick, simple input fields ✅ Controlled: &amp;lt;input value={value} onChange={e =&amp;gt; setValue(e.target.value)} /&amp;gt; ✅ Uncontrolled: &…

React Read answer
Junior PDF
What is lifting state up in React?

Lifting state up means moving state to the nearest common ancestor when multiple components need to share or modify it. ✅ Example: function Parent() { const [value, setValue] = useState(""); return ( &lt;&gt; &lt;Input v…

React Read answer
Junior PDF
What is useEffect and when do you use it?

useEffect lets you run side effects in functional components (like data fetching, subscriptions, etc.). ✅ Syntax: useEffect(() =&gt; { // Side effect return () =&gt; { // Cleanup }; }, [dependencies]); ✅ Common use cases…

React Read answer
Junior PDF
What is the difference between useEffect and useLayoutEffect?

Feature useEffect useLayoutEffect When it runs After paint Before paint (after DOM mutation) Use for Async tasks, data fetching Measuring DOM, sync layout Blocking paint? ❌ No ✅ Yes (can cause jank) 🔍 Use useLayoutEffec…

React Read answer
Junior PDF
What is useCallback and when should it be used?

useCallback memoizes a function to avoid unnecessary re-creations. ✅ Syntax: const memoizedCallback = useCallback(() =&gt; { doSomething(a, b); }, [a, b]); ✅ Use case: Prevents unnecessary re-renders of child components…

React Read answer
Junior PDF
What is Redux and why might you use it with React?

Redux is a predictable state container for JavaScript apps, often used with React. ✅ Why use Redux? Centralizes app state Makes state predictable and traceable Useful in large-scale apps with deeply nested components Wor…

React Read answer
Junior PDF
What is the difference between local component state and global state?

Local State (useState) Global State (Redux/Context) Exists within a component Shared across multiple components Ideal for UI-level concerns Ideal for app-wide data (e.g., auth, theme) Cannot be accessed by siblings Easil…

React Read answer
Junior PDF
What is the Context API and how does it compare to Redux? Context API is a built-in way to pass data globally without prop drilling. Feature Context API Redux Built-in? ✅ Yes ❌ No (external lib) Use case Small to medium apps Large/complex apps Boilerplate Minimal More (simplified by RTK)

Answer: sync support Manual Built-in via middleware DevTools ❌ Limited ✅ Excellent support What interviewers expect A clear definition tied to React in React.js projects Trade-offs (performance, maintainability, security…

React Read answer
Junior PDF
What is React Router? React Router is the standard library for routing in React applications. It enables navigation between different components or views without full page reloads, helping build single-page

Answer: pplications (SPA). Declarative routing: Allows you to define routes using JSX. Dynamic routing: Routes can be dynamically rendered based on the state, props, or URL. What interviewers expect A clear definition ti…

React Read answer
Junior PDF
What is the difference between BrowserRouter and HashRouter? Feature BrowserRouter HashRouter URL structure Clean URLs (e.g., /home, /about) URLs include a # (e.g., /home#about) Usage Preferred for modern apps on

web server Useful for apps without server-side routing (e.g., static sites) History API support Uses the HTML5 history API Uses the URL's hash to manage routing SEO friendliness SEO-friendly (with server-side configurati…

React Read answer
Junior PDF
What is the difference between Link and NavLink? Feature Link NavLink Purpose Navigate between pages Navigation with active styling

ctive style No built-in active style utomatically adds an active class when the route is ctive Use case Basic navigation For creating navigation menus with active links (e.g., highlighting the active link) Example of Nav…

React Read answer
Junior PDF
What is code splitting and how do you implement it?

Answer: Code splitting is the practice of breaking up the bundle into smaller chunks so that only the required code is loaded when needed, improving initial load performance. How to Implement: What interviewers expect A…

React Read answer
Junior PDF
What is lazy loading in React?

Lazy loading is a design pattern where resources (like components) are loaded only when they are needed (e.g., when they enter the viewport or the user navigates to the route). In React, lazy loading is typically impleme…

React Read answer
Junior PDF
What is Jest and how is it used with React?

Jest is a JavaScript testing framework created by Facebook, commonly used for testing React applications. It comes with: Test runner: Executes test files. Assertions: Provides functions like expect() for asserting condit…

React Read answer
Junior PDF
What is React Testing Library and how does it differ from Enzyme? React Testing Library (RTL) and Enzyme are two popular testing utilities for React. Feature React Testing Library Enzyme Philosophy Tests behavior from the user's perspective Tests component internals and implementation Test Focus Interaction, rendering, and

ccessibility Shallow rendering, component state, and props Testing Approach Encourages testing DOM behavior and accessibility Encourages testing component internals and methods Integration with React Built with React’s r…

React Read answer
Junior PDF
What is snapshot testing?

Snapshot testing is a way of testing a component’s rendered output by saving it to a snapshot file and comparing it with future renders. This helps detect any unintended changes in the UI. How to write snapshot tests: Ru…

React Read answer
Junior PDF
What is the render props pattern? The render props pattern is a technique for sharing code between components using a prop whose value is a function (a “render prop”). This function can return JSX or other values,

llowing more dynamic behavior and custom rendering. Purpose: It enables a component to expose its logic while letting its consumers define how the output is rendered. Example: class MouseTracker extends React.Component {…

React Read answer
Junior PDF
What is reconciliation in React?

Reconciliation is the process by which React updates the DOM efficiently when a component's state or props change. React uses a virtual DOM to compare the new virtual DOM tree with the previous one and determines the min…

React Read answer

React.js React.js Tutorial · React

pplications. It helps developers create reusable UI components, manage state efficiently,

nd update the UI in a performant way.

✅ Why use React?

  • Easy to break UIs into components
  • Efficient updates with Virtual DOM
  • Rich ecosystem (React Router, Redux, etc.)
  • Backed by Facebook and a large community
Permalink & share

React.js React.js Tutorial · React

Answer: function Home() { return &lt;h1&gt;Home Page&lt;/h1&gt;; } function About() { return &lt;h1&gt;About Page&lt;/h1&gt;; }

What interviewers expect

  • A clear definition tied to React in React.js projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production React.js application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in React.js architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

React.js React.js Tutorial · React

JSX stands for JavaScript XML. It lets you write HTML-like syntax in JavaScript.

const element = <h1>Hello, world!</h1>;

🚫 No, browsers cannot read JSX directly. JSX needs to be transpiled (e.g., using

Babel) into regular JavaScript.

Permalink & share

React.js React.js Tutorial · React

The Virtual DOM is a lightweight in-memory representation of the real DOM. React

updates the Virtual DOM first and compares it with the previous version, only applying the

necessary changes to the real DOM.

✅ Benefit: Improves performance by reducing real DOM operations.

Permalink & share

React.js React.js Tutorial · React

State is data that is local to a component and can change over time.

✅ Example using useState:

import { useState } from 'react';

function Counter() {

const [count, setCount] = useState(0);
return <button onClick={() => setCount(count +

1)}>{count}</button>;

}
Permalink & share

React.js React.js Tutorial · React

Answer: Feature Props State Mutable? ❌ No (read-only) ✅ Yes Who sets it? Parent component Component itself Used for Passing data Handling internal data

What interviewers expect

  • A clear definition tied to React in React.js projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production React.js application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in React.js architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

React.js React.js Tutorial · React

Answer: Keys help React identify which items have changed, been added, or removed. ✅ Example: {items.map(item =&gt; ( &lt;li key={item.id}&gt;{item.name}&lt;/li&gt; ))} 🛑 Avoid using array index as key unless absolutely necessary.

What interviewers expect

  • A clear definition tied to React in React.js projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production React.js application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in React.js architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

React.js React.js Tutorial · React

Answer: ccess value via useState ref Example use case Forms with validation Quick, simple input fields ✅ Controlled: &lt;input value={value} onChange={e =&gt; setValue(e.target.value)} /&gt; ✅ Uncontrolled: &lt;input ref={inputRef} /&gt;

What interviewers expect

  • A clear definition tied to React in React.js projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production React.js application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in React.js architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

React.js React.js Tutorial · React

Lifting state up means moving state to the nearest common ancestor when multiple

components need to share or modify it.

✅ Example:

function Parent() {

const [value, setValue] = useState("");
return (

<>

<Input value={value} onChange={setValue} />

<Display value={value} />

</>

);

}

function Input({ value, onChange }) {

return <input value={value} onChange={e =>

onChange(e.target.value)} />;

}

function Display({ value }) {

return <p>{value}</p>;
}

React Hooks

Permalink & share

React.js React.js Tutorial · React

useEffect lets you run side effects in functional components (like data fetching,

subscriptions, etc.).

✅ Syntax:

useEffect(() => {

// Side effect

return () => {

// Cleanup

};

}, [dependencies]);

✅ Common use cases:

  • Fetching data
  • Event listeners
  • Updating DOM directly
  • Subscribing to services
Permalink & share

React.js React.js Tutorial · React

Feature useEffect useLayoutEffect

When it runs After paint Before paint (after DOM mutation)

Use for Async tasks, data

fetching

Measuring DOM, sync layout

Blocking paint? ❌ No ✅ Yes (can cause jank)

🔍 Use useLayoutEffect only when layout measurement or synchronously modifying

DOM is necessary.

Permalink & share

React.js React.js Tutorial · React

useCallback memoizes a function to avoid unnecessary re-creations.

✅ Syntax:

const memoizedCallback = useCallback(() => {

doSomething(a, b);

}, [a, b]);

✅ Use case:

  • Prevents unnecessary re-renders of child components receiving functions as props.

const handleClick = useCallback(() => {

console.log("Clicked!");

}, []);

Permalink & share

React.js React.js Tutorial · React

Redux is a predictable state container for JavaScript apps, often used with React.

✅ Why use Redux?

  • Centralizes app state
  • Makes state predictable and traceable
  • Useful in large-scale apps with deeply nested components
  • Works well with middleware for async tasks (like API calls)
Permalink & share

React.js React.js Tutorial · React

Local State (useState) Global State (Redux/Context)

Exists within a component Shared across multiple components

Ideal for UI-level concerns Ideal for app-wide data (e.g., auth,

theme)

Cannot be accessed by

siblings

Easily accessible across app

Permalink & share

React.js React.js Tutorial · React

Answer: sync support Manual Built-in via middleware DevTools ❌ Limited ✅ Excellent support

What interviewers expect

  • A clear definition tied to React in React.js projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production React.js application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in React.js architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

React.js React.js Tutorial · React

Answer: pplications (SPA). Declarative routing: Allows you to define routes using JSX. Dynamic routing: Routes can be dynamically rendered based on the state, props, or URL.

What interviewers expect

  • A clear definition tied to React in React.js projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production React.js application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in React.js architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

React.js React.js Tutorial · React

web server

Useful for apps without server-side

routing (e.g., static sites)

History API

support

Uses the HTML5 history API Uses the URL's hash to manage

routing

SEO

friendliness

SEO-friendly (with server-side

configuration)

Less SEO-friendly due to # in the

URL

Permalink & share

React.js React.js Tutorial · React

ctive

style

No built-in active

style

utomatically adds an active class when the route is

ctive

Use case Basic navigation For creating navigation menus with active links (e.g.,

highlighting the active link)

Example of NavLink:

import { NavLink } from 'react-router-dom';

function Navbar() {

return (

<nav>

<NavLink to="/" activeClassName="active">Home</NavLink>

<NavLink to="/about" activeClassName="active">About</NavLink>

</nav>

);

}
Permalink & share

React.js React.js Tutorial · React

Answer: Code splitting is the practice of breaking up the bundle into smaller chunks so that only the required code is loaded when needed, improving initial load performance. How to Implement:

What interviewers expect

  • A clear definition tied to React in React.js projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production React.js application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in React.js architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

React.js React.js Tutorial · React

Lazy loading is a design pattern where resources (like components) are loaded only when

they are needed (e.g., when they enter the viewport or the user navigates to the route).

In React, lazy loading is typically implemented using React.lazy and Suspense.

Example:

import { Suspense } from 'react';

const HeavyComponent = React.lazy(() => import('./HeavyComponent'));

function App() {

return (

<Suspense fallback={<div>Loading...</div>}>

<HeavyComponent />

</Suspense>

);

}

This ensures that the heavy component is only loaded when the app actually needs it.

Permalink & share

React.js React.js Tutorial · React

Jest is a JavaScript testing framework created by Facebook, commonly used for testing

React applications. It comes with:

  • Test runner: Executes test files.
  • Assertions: Provides functions like expect() for asserting conditions.
  • Mocks: Mocking capabilities for API calls or functions.
  • Snapshots: Captures UI output at a given time.

How to use Jest with React:

Install Jest:

npm install --save-dev jest

Permalink & share

React.js React.js Tutorial · React

ccessibility

Shallow rendering, component

state, and props

Testing Approach Encourages testing DOM

behavior and accessibility

Encourages testing component

internals and methods
Integration with

React

Built with React’s rendering

behavior in mind

Requires enzyme adapter for

different React versions

Recommendation More modern, encourages

better testing practices

Still used, but React Testing

Library is more popular

Key difference:

  • React Testing Library focuses on testing the output of your components (UI

behavior), similar to how a user interacts with the app.

  • Enzyme focuses more on testing the internal implementation (component state,

methods).

Permalink & share

React.js React.js Tutorial · React

Snapshot testing is a way of testing a component’s rendered output by saving it to a

snapshot file and comparing it with future renders. This helps detect any unintended

changes in the UI.

How to write snapshot tests:

Run Jest with snapshot testing:

npm test -- --updateSnapshot

Permalink & share

React.js React.js Tutorial · React

llowing more dynamic behavior and custom rendering.

  • Purpose: It enables a component to expose its logic while letting its consumers

define how the output is rendered.

Example:

class MouseTracker extends React.Component {
state = { x: 0, y: 0 };

handleMouseMove = (event) => {

this.setState({

x: event.clientX,

y: event.clientY,

});

};

render() {

return (

<div onMouseMove={this.handleMouseMove}>

{this.props.render(this.state)}

</div>

);

}
}

const App = () => (

<MouseTracker render={({ x, y }) => (

<h1>The mouse position is ({x}, {y})</h1>

)} />

);

In this example, MouseTracker uses the render prop pattern to allow the parent

component to decide how to render the mouse position data.

Permalink & share

React.js React.js Tutorial · React

Reconciliation is the process by which React updates the DOM efficiently when a

component's state or props change. React uses a virtual DOM to compare the new virtual

DOM tree with the previous one and determines the minimal set of changes required to

update the actual DOM.

Key Concepts:

  • Virtual DOM: A lightweight representation of the real DOM.
  • Diffing algorithm: React’s algorithm compares the old and new virtual DOMs to find

the differences (diffs) and apply the smallest set of changes.

Reconciliation Flow:

Permalink & share
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details