Skip to content
IT glossary
FrontendUpdated December 3, 2026

Component

Компонент

A building block of a user interface, such as a button, product card, or form. It defines what that part of the screen shows and can specify how it responds to user actions.

What is a frontend component?

A component brings the UI for one job into a named unit. A product card, for example, displays details about a product and offers an action such as adding it to a cart. You can place the same card component on a search page and a recommendations page without duplicating its layout. Reuse is useful, not mandatory: a checkout form can be a component even if it appears on only one screen.

Inputs, state, and composition

A component can render other components. A page might render a results list, which renders one card per result. Building larger pieces this way is called composition. The resulting component tree is not the same as the browser's DOM tree: one component can render several DOM elements or none at all.

In React, inputs from a parent are called props. A card can read its title from props and call a function passed by its parent when the user selects the product. A component can also have state: values it remembers between renders, such as whether a details panel is open. An update to state can cause React to render again. Rendering calculates what the UI should look like; it does not necessarily change the DOM.

Example: two independent panels

import { useState } from 'react';

function Details({ title, children }) {
  const [open, setOpen] = useState(false);
  return (
    <section>
      <button type="button" aria-expanded={open}
        onClick={() => setOpen(value => !value)}>
        {title}
      </button>
      {open && <div>{children}</div>}
    </section>
  );
}

A parent can render one Details panel for shipping and another for returns, passing a title and content to each. Each mounted panel tracks its own open state, so opening one doesn't open the other. If the page should allow only one panel to be open at a time, the parent can track which panel is open and pass that information down.

Where components fit and what to watch for

React, Vue, and Angular all support component-based UIs, but their APIs and update behavior differ. Web Components refers to specific browser standards, including custom elements. A React component is not automatically a custom element just because you can write it as a tag in JSX.

Keep state near the code that needs it. If two components need to agree on a value, give that value one owner rather than maintaining two copies and trying to synchronize them. Likewise, don't extract every wrapper into a component: a good boundary gives a piece of UI a clear job and makes the surrounding code easier to read.

How it comes up in interviews

You might be asked to sketch a search interface, identify its components, and explain how data moves between them. A strong answer names who owns the search query, how the input reports edits, and how the results list receives its items. The reasoning matters more than the number of components you draw.

“Component” questions from real interviews

Asked at 484 companies

All Frontend questions