Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: import React, { Suspense } from 'react'; const LazyComponent = React.lazy(() => import('./LazyComponent')); function App() { return ( <Suspense fallback={<div>Loading...</div>}> <Laz…
Short answer: import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; function App() { return ( <Router> <Switch> <Route exact path="/" component={Home} /> <Route path=&q…
Short answer: function counterReducer(state = 0, action) { switch (action.type) { case 'INCREMENT': return state + 1; default: return state; } } Example code function counterReducer(state = 0, action) { switch (action.ty…
Short answer: (functional components or custom hooks) React enforces these rules with a linter: eslint-plugin-react-hooks. Real-world example (ShopNest) ShopNest’s cart icon uses useState for count and useEffect to load…
Short answer: JSX – JavaScript + XML Components – Reusable and composable Virtual DOM – Efficient DOM updates Unidirectional data flow – One-way data binding Lifecycle methods (in class components) Hooks (in functional c…
Short answer: Can browsers read JSX directly? 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.…
Short answer: sure to account for the most recent state. Real-world example (ShopNest) ShopNest’s cart icon uses useState for count and useEffect to load the cart once on mount. Say this in the interview Define — one cle…
Short answer: These libraries help solve problems like global namespace conflicts and style collisions in large React applications, allowing for scoped, dynamic styles. Real-world example (ShopNest) ShopNest’s storefront…
Short answer: Scoped CSS that helps avoid name collisions. import styles from './App.module.css'; function App() { return <div className={styles.container}>Hello, world!</div>; Real-world example (ShopNest) S…
Short answer: making sure your code follows a consistent style. Real-world example (ShopNest) ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state. Say t…
Short answer: Example: import { render, screen, fireEvent } from '@testing-library/react'; import MyComponent from './MyComponent'; test('renders the component and interacts', () => { render(<MyComponent />); co…
Short answer: If using hooks, make sure you are providing the correct dependencies to useEffect and useMemo, and avoid unnecessary recalculations. Real-world example (ShopNest) ShopNest’s cart icon uses useState for coun…
Short answer: the items that are visible in the viewport. Example of list optimization with key: const List = ({ items }) => { return ( <ul> {items.map(item => ( <li key={item.id}>{item.name}</li>…
Short answer: function Home() { return <h1>Home Page</h1>; } function About() { return <h1>About Page</h1>; } Example code function Home() { return <h1>Home Page</h1>; } function About…
Short answer: import { createStore } from 'redux'; const store = createStore(counterReducer); Example code import { createStore } from 'redux'; const store = createStore(counterReducer); Real-world example (ShopNest) Pro…
Short answer: 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…
Short answer: manipulating the DOM when it’s unnecessary) can lead to performance issues. Real-world example (ShopNest) ShopNest’s cart icon uses useState for count and useEffect to load the cart once on mount. Say this…
Short answer: Example: function App() { const isAuthenticated = localStorage.getItem('authToken'); return isAuthenticated ? <Dashboard /> : <Login />; } For handling OAuth or third-party login (e.g., with Goo…
Short answer: Use performance monitoring tools like why-did-you-render to detect unnecessary re-renders in functional components. Example: npm install @welldone-software/why-did-you-render Testing React Components Real-w…
Short answer: optimization can degrade performance, especially if each item is re-rendered every time the parent changes. Real-world example (ShopNest) When rendering cart lines, use a stable key={item.id} —not the array…
Short answer: Feature React Angular Vue Type Library (UI focused) Framework (full-featured) Framework (lightweight) DOM Handling Virtual DOM Real DOM Virtual DOM Data Binding One-way Two-way Both supported Learning Curve…
Short answer: engines. Example (with react-helmet): import { Helmet } from 'react-helmet'; function MyPage() { return ( <div> <Helmet> <title>My SEO Optimized Page</title> <meta name="desc…
Short answer: or effects that trigger multiple renders. ⚙ Miscellaneous React Concepts Real-world example (ShopNest) ProductCard receives price via props. The parent Catalog owns selected filters in state and passes them…
Short answer: CSS-in-JS allows writing actual CSS inside JavaScript files. Supports dynamic styling and theming. import styled from 'styled-components'; const Button = styled.button` background: ${(props) => (props.pr…
Short answer: Many of these tools are integrated automatically when you use CRA or Next.js, but they can be configured or customized in more advanced setups. Real-world example (ShopNest) ShopNest’s storefront is React:…
React.js React.js Tutorial · React
Short answer: import React, { Suspense } from 'react'; const LazyComponent = React.lazy(() => import('./LazyComponent')); function App() { return ( <Suspense fallback={<div>Loading...</div>}> <LazyComponent /> </Suspense> ); } React.lazy enables dynamic imports for code splitting. Suspense lets you specify a loading state while waiting for the component to load.
ProductCard receives price via props. The parent Catalog owns selected filters in state and passes them down.
React.js React.js Tutorial · React
Short answer: import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; function App() { return ( <Router> <Switch> <Route exact path="/" component={Home} /> <Route path="/about" component={About} /> </Switch> </Router> ); }
ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state.
React.js React.js Tutorial · React
Short answer: function counterReducer(state = 0, action) { switch (action.type) { case 'INCREMENT': return state + 1; default: return state; } }
function counterReducer(state = 0, action) { switch (action.type) { case 'INCREMENT': return state + 1; default: return state;
}
}
ProductCard receives price via props. The parent Catalog owns selected filters in state and passes them down.
React.js React.js Tutorial · React
Short answer: (functional components or custom hooks) React enforces these rules with a linter: eslint-plugin-react-hooks.
ShopNest’s cart icon uses useState for count and useEffect to load the cart once on mount.
React.js React.js Tutorial · React
Short answer: JSX – JavaScript + XML Components – Reusable and composable Virtual DOM – Efficient DOM updates Unidirectional data flow – One-way data binding Lifecycle methods (in class components) Hooks (in functional components)
ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state.
React.js React.js Tutorial · React
Short answer: Can browsers read JSX directly? 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.
React.js React.js Tutorial · React
Short answer: sure to account for the most recent state.
ShopNest’s cart icon uses useState for count and useEffect to load the cart once on mount.
React.js React.js Tutorial · React
Short answer: These libraries help solve problems like global namespace conflicts and style collisions in large React applications, allowing for scoped, dynamic styles.
ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state.
React.js React.js Tutorial · React
Short answer: Scoped CSS that helps avoid name collisions. import styles from './App.module.css'; function App() { return <div className={styles.container}>Hello, world!</div>;
ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state.
React.js React.js Tutorial · React
Short answer: making sure your code follows a consistent style.
ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state.
React.js React.js Tutorial · React
Short answer: Example: import { render, screen, fireEvent } from '@testing-library/react'; import MyComponent from './MyComponent'; test('renders the component and interacts', () => { render(<MyComponent />); const button = screen.getByText('Click me'); fireEvent.click(button); expect(screen.getByText('Clicked!')).toBeInTheDocument(); });
import { render, screen, fireEvent } from '@testing-library/react'; import MyComponent from './MyComponent'; test('renders the component and interacts', () => { render(<MyComponent />); const button = screen.getByText('Click me'); fireEvent.click(button); expect(screen.getByText('Clicked!')).toBeInTheDocument(); });
ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state.
React.js React.js Tutorial · React
Short answer: If using hooks, make sure you are providing the correct dependencies to useEffect and useMemo, and avoid unnecessary recalculations.
ShopNest’s cart icon uses useState for count and useEffect to load the cart once on mount.
React.js React.js Tutorial · React
Short answer: the items that are visible in the viewport. Example of list optimization with key: const List = ({ items }) => { return ( <ul> {items.map(item => ( <li key={item.id}>{item.name}</li> ))} </ul> ); };
ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state.
React.js React.js Tutorial · React
Short answer: function Home() { return <h1>Home Page</h1>; } function About() { return <h1>About Page</h1>; }
function Home() { return <h1>Home Page</h1>;
} function About() { return <h1>About Page</h1>;
}
ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state.
React.js React.js Tutorial · React
Short answer: import { createStore } from 'redux'; const store = createStore(counterReducer);
import { createStore } from 'redux'; const store = createStore(counterReducer);
ProductCard receives price via props. The parent Catalog owns selected filters in state and passes them down.
React.js React.js Tutorial · React
Short answer: 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. 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. 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. 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.
React.js React.js Tutorial · React
Short answer: manipulating the DOM when it’s unnecessary) can lead to performance issues.
ShopNest’s cart icon uses useState for count and useEffect to load the cart once on mount.
React.js React.js Tutorial · React
Short answer: Example: function App() { const isAuthenticated = localStorage.getItem('authToken'); return isAuthenticated ? <Dashboard /> : <Login />; } For handling OAuth or third-party login (e.g., with Google or Facebook), you might use a library like Firebase or Auth0.
Example: function App() { const isAuthenticated = localStorage.getItem('authToken');
return isAuthenticated ? <Dashboard /> : <Login />;
}
For handling OAuth or third-party login (e.g., with Google or Facebook), you might use a library like Firebase or Auth0.
React.js React.js Tutorial · React
Short answer: Use performance monitoring tools like why-did-you-render to detect unnecessary re-renders in functional components. Example: npm install @welldone-software/why-did-you-render Testing React Components
ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state.
React.js React.js Tutorial · React
Short answer: optimization can degrade performance, especially if each item is re-rendered every time the parent changes.
When rendering cart lines, use a stable key={item.id}—not the array index—so React updates the right row after delete.
React.js React.js Tutorial · React
Short answer: Feature React Angular Vue Type Library (UI focused) Framework (full-featured) Framework (lightweight) DOM Handling Virtual DOM Real DOM Virtual DOM Data Binding One-way Two-way Both supported Learning Curve Medium Steep Easy
ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state.
React.js React.js Tutorial · React
Short answer: engines. Example (with react-helmet): import { Helmet } from 'react-helmet'; function MyPage() { return ( <div> <Helmet> <title>My SEO Optimized Page</title> <meta name="description" content="Description of my page for SEO" /> </Helmet> <h1>Welcome to My SEO Page</h1> </div> ); }
ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state.
React.js React.js Tutorial · React
Short answer: or effects that trigger multiple renders. ⚙ Miscellaneous React Concepts
ProductCard receives price via props. The parent Catalog owns selected filters in state and passes them down.
React.js React.js Tutorial · React
Short answer: CSS-in-JS allows writing actual CSS inside JavaScript files. Supports dynamic styling and theming. import styled from 'styled-components'; const Button = styled.button` background: ${(props) => (props.primary ? 'blue' : 'gray')}; color: white; `; function App() { return <Button primary={true}>Click Me</Button>;
ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state.
React.js React.js Tutorial · React
Short answer: Many of these tools are integrated automatically when you use CRA or Next.js, but they can be configured or customized in more advanced setups.
ShopNest’s storefront is React: components for ProductCard, CartDrawer, and CheckoutForm, with hooks for local UI state.