What is accessibility in React and why does it matter?
Accessibility means building an app that everyone can use, including people who use screen readers, keyboards only, or have vision or motor difficulties.
The 50 React questions worth preparing first, picked from all 205 on W3Teacher and spread across 41 topics. Each one has a short answer here and a full answer with examples and follow-ups on its own page.
Accessibility means building an app that everyone can use, including people who use screen readers, keyboards only, or have vision or motor difficulties.
Framer Motion is a popular animation library for React. Instead of writing complex CSS animations by hand, you use its motion components and simply describe the starting state, the ending state, and how long the change should take.
A build tool takes all your separate JavaScript, CSS, and image files and combines them into a small number of optimized files that a browser can load quickly. It also converts modern JSX and newer JavaScript syntax into a form that older browsers can understand.
A class component is written using JavaScript class syntax and extends React.Component. It manages state using this.state and this.setState, and it needs a render method that returns the JSX to display.
Code splitting means breaking your app's JavaScript into smaller separate files instead of one huge file. The browser only downloads the small piece it needs for the current page, making the first page load much faster, especially for large apps with many different sections.
Component composition means building complex user interfaces by combining small, simple components together, instead of writing one giant component that does everything. This makes each piece easier to understand, test, and reuse in different places across an app.
JSX is a special syntax that lets you write HTML looking code directly inside your JavaScript files. It makes it much easier to see what a component will look like on the screen, and it gets converted into regular JavaScript function calls before the browser ever sees it.
You can use a regular JavaScript if statement before the return, a ternary expression directly inside JSX, or the double ampersand operator when you only want to show something in one specific case and nothing otherwise.
Context lets you share a value, such as the current logged in user or a color theme, with many components at once, without needing to manually pass it down as a prop through every single component in between.
A custom hook is simply a JavaScript function whose name starts with use, and it lets you reuse stateful logic between different components without repeating the same code. It can call other hooks inside it, like useState or useEffect, just like a regular component can.
Fetching data with plain useEffect means you have to manually handle loading states, errors, caching, and refetching yourself every single time.
A production build is the final, optimized version of your app, created by running a build command like npm run build. It produces smaller, faster files with helpful development warnings removed, ready to be uploaded to a real web server for actual visitors to use.
useEffect lets you run code that reaches outside of React, such as fetching data, setting a timer, or updating the page title, after a component renders. It runs after the screen updates, and you can control exactly when it runs using its dependency array.
An error boundary is a special component that catches JavaScript errors happening anywhere in its child components, and shows a friendly fallback message instead of letting the entire app crash and show a blank white screen to the user.
A controlled input gets its current value from React state and updates that state every time the user types, using the onChange event. This means React always knows exactly what the input currently shows, making it easy to validate or transform the value at any moment.
Hooks are special functions, like useState and useEffect, that let a function component use features such as state and lifecycle behavior, which used to only be available in class components.
Internationalization, often shortened to i18n, means building an app so it can easily show text in different languages for different users around the world.
React.memo wraps a component and tells React to skip re rendering it if its props have not actually changed since the last render. This is useful for components that render often but whose output usually stays the same, saving unnecessary rendering work.
A Portal lets you render a component's content into a different part of the actual page structure, outside of its normal parent element, while it still behaves like a normal part of your React component tree.
Props are values passed into a component from its parent, and a component cannot change its own props directly. State is data that a component manages internally and can change over time, usually in response to user actions, and changing state causes the component to re render.
React DevTools is a free browser extension available for Chrome and Firefox that adds two new tabs to your browser's developer tools, letting you inspect the component tree, view current props and state, and see exactly why a component re rendered.
A ref gives you a way to directly access an actual DOM element or to store a value that does not need to cause a re render when it changes.
Client side routing lets a user navigate between different pages of a single page app without the browser actually reloading the page from the server every single time.
Cross site scripting happens when an attacker manages to inject malicious code into a page, which then runs in another user's browser, often stealing information or performing unwanted actions.
Server side rendering means generating the full HTML for a page on the server before sending it to the browser, instead of sending an almost empty page and building everything with JavaScript afterward.
State management refers to how an app organizes and shares data that changes over time, such as the current logged in user, items in a shopping cart, or a form's values.
Redux keeps all of an app's shared state in one single central store, and the only way to change that state is by sending a plain object called an action to a function called a reducer.
Static site generation builds the HTML for every page in advance, at build time, before any visitor even requests the page, then simply serves those already built files instantly. Server side rendering instead builds the HTML fresh on every single request.
Strict Mode is a development only tool that helps find potential problems in your app early, before they cause real bugs.
A CSS Module is a regular CSS file where every class name is automatically made unique behind the scenes during the build process, so a class name like button used in one component's CSS file never accidentally conflicts with a class of the same name used in a completely…
Suspense lets a component tell React that it is not ready yet, such as while data is still loading, and React shows a fallback, like a loading spinner, until it is ready.
React Testing Library encourages testing a component the way an actual user would interact with it, such as finding a button by its visible text and clicking it, rather than checking internal details like a component's specific state values.
TypeScript adds type checking to JavaScript, catching many common mistakes, like passing the wrong kind of value to a component, before the code even runs, right inside your code editor.
The virtual DOM is a lightweight, plain JavaScript representation of what the actual page should look like, kept in memory by React.
A component is a reusable piece of the user interface, like a button, a form, or an entire page. Today almost all components are function components, which are plain JavaScript functions that return JSX.
You use the array's map method to turn each item in a list into a piece of JSX, and each resulting element needs a unique key prop so React can keep track of which item is which, especially when the list changes over time.
useTransition lets you mark a state update as not urgent, so React can keep the screen responsive to more important things, like typing in a search box, while a slower update, like filtering a huge list, happens in the background without freezing the page.
This pattern separates a component into two parts. The container component handles data fetching and logic, while the presentational component only receives data through props and focuses purely on how things look.
A higher order component, often shortened to HOC, is a function that takes a component as input and returns a new, enhanced component with extra behavior added, without changing the original component's own code.
The render props pattern means passing a function as a prop to a component, and that component calls the function to decide what to actually display, often passing some internal data or state into that function.
A server action is a function that runs directly on the server but can be called from a component as if it were a normal function, letting a form submit data and update a database without needing to manually build a separate API endpoint or write client side fetch code.
A Server Component renders entirely on the server, sending only the finished result to the browser instead of the actual JavaScript code needed to run it.
A reducer is a plain function that takes the current state and an action describing what happened, and returns the new state based on that action. It should never directly change the existing state, but instead always return a brand new state object reflecting the update.
ARIA attributes give extra information to screen readers when plain HTML is not enough to describe what an element does. For example, aria label describes a button that only has an icon, and aria expanded tells a screen reader whether a menu is open or closed.
React Spring is based on physics, meaning you describe how something should move using spring settings like tension and friction rather than a fixed duration. This often looks more natural because the animation speeds up and slows down the way real physical objects do.
Vite starts a development server almost instantly because it only processes the files a page actually needs right away, instead of bundling the entire app upfront like older tools did.
componentDidMount runs one time, right after a component first appears on the screen. It is commonly used to fetch data from a server or set up something like a timer.
React.lazy takes a function that dynamically imports a component, and returns a special component that only actually loads that code the first time it is rendered.
The children prop automatically holds whatever content is placed between the opening and closing tags of a component. It lets a component wrap around any content without needing to know in advance exactly what that content will be.
useDeferredValue lets you keep showing an older, slightly outdated version of a value while React works on rendering the newer version in the background.
Run a timed React mock interview: random questions, answer out loud, reveal the model answer and get a readiness score you can share.