Top 30 Components Interview Questions and Answers
30 multiple-choice questions on Components, drawn from 30 bites out of the 78 tagged Components on Tezvyn. Answer them here or read straight down. Every question carries the correct option, why it is correct, and a link to the bite it came from.
30 questions. Pick an answer, or open “Show the answer” to read it.
Answers are graded in your browser. Nothing is saved, and no XP or streak is earned here. The app keeps score.
Question 1 of 30
For displaying long, scrolling lists of data in React Native, which component is recommended for optimal performance?
Show the answer
Answer: d · FlatList, because it efficiently renders only the items currently visible on screen.
FlatList is the recommended component for long lists because it optimizes performance by only rendering items currently visible on screen. ScrollView, while providing scrolling, renders all its children at once, which can lead to performance issues with extensive content.
Read the full bite: React Native Core Components: Your UI Building Blocks
Question 2 of 30
Which accurately describes the two primary ways to define a React component?
Show the answer
Answer: c · Function components and class components, with function components being the standard for new React 19 code
Function components and class components are the two distinct definition paradigms, and function components are the React 19 default. Arrow functions and function declarations are merely alternate syntaxes for the same function component paradigm, not separate ways to define components.
Read the full bite: What are the two main ways to define a component in React?
Question 3 of 30
Which statement accurately describes a core principle of how React components should handle props?
Show the answer
Answer: b · Props facilitate a one-way data flow, allowing data to be passed from parent to child components.
The card states that props establish a 'clear, one-way data flow from parent components to child components.' This ensures predictability and reusability. Option A is incorrect because a component should never modify the props it receives; that's what state is for.
Read the full bite: React Props: Arguments for Your Components
Question 4 of 30
What is the main advantage of using a React Fragment (e.g., <></>) over a <div> when a component needs to return multiple elements?
Show the answer
Answer: d · Fragments prevent the addition of an unnecessary wrapper DOM node, maintaining cleaner HTML structure.
React Fragments are designed to group multiple elements for React's internal processing without adding an extra DOM node to the final HTML, which is essential for valid HTML structures and avoiding unwanted styling issues. Fragments themselves do not add a DOM node, so they cannot have CSS classes or event listeners applied to them directly.
Read the full bite: React Fragments: Group Elements Without a Wrapper
Question 5 of 30
A developer chooses Vue Single-File Components (SFCs) for a new application. What is the most significant implication regarding how their code will be processed for the browser?
Show the answer
Answer: c · A build tool will be necessary to compile the .vue files into standard JavaScript and CSS that browsers can execute.
The card explicitly states that .vue files are not directly understood by browsers and require a build tool to compile them into standard JavaScript and CSS. Option D is incorrect because SFCs cannot be directly interpreted by browsers.
Question 6 of 30
In React, when is an early return with if/else preferable to an inline ternary inside JSX?
Show the answer
Answer: a · When branches are large, structurally different, or to reduce nesting
Early returns improve readability when branches are large, structurally different, or deeply nested. Option B actually describes when an inline ternary is the better choice, not an early return.
Read the full bite: Describe two patterns for conditional rendering in JSX
Question 7 of 30
What is the key behavioral difference between nesting Text inside Text versus nesting components inside a View?
Show the answer
Answer: c · Text inside Text inherits text styles like color and fontSize, while View children do not inherit styles
Nested Text inherits text style properties from its parent Text, which is unique to text rendering. View does not propagate styles to its children, so each child View is styled independently.
Question 8 of 30
What is the primary reason styles applied to a parent View component do not directly affect text within a child Text component?
Show the answer
Answer: b · Text components operate within a distinct "text world" where styles must be explicitly defined or nested.
The Text component creates a special "text world" with its own layout and styling rules, meaning styles from a parent View are not inherited. Instead, styles must be applied directly to the Text component itself or through nested Text components.
Read the full bite: React Native's Text Component: Beyond Displaying Words
Question 9 of 30
When creating a WelcomeDialog component that uses a generic Dialog component to display a fixed title and message, which approach best exemplifies React's "favor composition" principle?
Show the answer
Answer: b · WelcomeDialog renders the Dialog component internally, passing it specific title and message props.
The card states that for specialization, a more specific component simply renders a more generic one and configures it with props, as exemplified by WelcomeDialog rendering Dialog. Option C uses class inheritance, which the card explicitly advises against for UI component hierarchies.
Read the full bite: React's Rule: Favor Composition Over Inheritance
Question 10 of 30
Why should icons in a developer-facing Figma system use a single flattened path without hardcoded fills?
Show the answer
Answer: c · It lets the icon inherit color in code via currentColor, supporting theming
A single color-agnostic path lets the icon inherit its color through currentColor, so one icon serves multiple themes. Hardcoded fills can be exported but block recoloring; flattening is not required for publishing.
Read the full bite: Building a scalable icon system in Figma
Question 11 of 30
Which characteristic primarily explains why ScrollView is discouraged for long, dynamic lists?
Show the answer
Answer: c · It renders all its child components into a single view at once, consuming significant resources.
The card explicitly states that ScrollView renders every single item, even those off-screen, leading to poor performance and high memory consumption. This simultaneous rendering of all content is the fundamental limitation, while other options describe consequences or secondary issues.
Question 12 of 30
What is the main advantage of using component variants in a design system?
Show the answer
Answer: b · They allow a single base component to represent many different forms by adjusting its properties.
The card states that variants allow "one core component to serve multiple, predictable purposes" by defining "properties and their possible values." This directly aligns with option B. Option A is incorrect because variants are for managing variations of existing components for repeatable patterns, not for creating new or unique, non-repeatable elements.
Read the full bite: Component Variants: One Component, Many Forms
Question 13 of 30
Which statement accurately describes a fundamental principle of using props in Vue components?
Show the answer
Answer: b · A child component must never directly mutate a prop it receives from its parent.
The card explicitly states that a critical rule is to 'never mutate a prop directly inside the child component,' emphasizing the one-way data flow principle. Options A and B describe incorrect data flow patterns, while option C suggests a less robust declaration method than recommended.
Read the full bite: Vue Component Props: Passing Data Downstream
Question 14 of 30
For which use case would a controlled component be the most appropriate choice?
Show the answer
Answer: b · An accordion where opening one panel automatically closes all others.
The card explicitly states that an accordion where expanding one panel collapses others is a canonical example requiring controlled components to coordinate state and maintain a single source of truth. Options A, B, and D describe scenarios where uncontrolled components are generally preferred because their state is self-contained or only needed at specific times, reducing boilerplate for the parent.
Question 15 of 30
Which approach should a child component use when it needs to change data received from its parent via props?
Show the answer
Answer: d · Emit an event or invoke a callback to ask the parent to update the data.
The child should treat props as read-only and request changes through events or callbacks, preserving unidirectional data flow and predictable state ownership. Directly mutating the prop (option B) breaks the explicit contract and makes debugging difficult because the parent loses control over its own state.
Read the full bite: Primary mechanism for passing data from parent to child component
Question 16 of 30
When a child must notify its parent of a new search query, which approach preserves proper encapsulation in Vue and Angular?
Show the answer
Answer: c · The child declares an event via defineEmits in Vue or @Output EventEmitter in Angular and emits the query upward.
Emitting a named, typed event through defineEmits or @Output/EventEmitter keeps the parent in control of state and follows framework conventions. Option D is tempting because direct mutation seems efficient, but it violates unidirectional data flow and breaks component encapsulation.
Read the full bite: How do you emit events from a child to parent component?
Question 17 of 30
Which statement accurately describes data passed to an Angular component using the input() function?
Show the answer
Answer: d · The child component receives a read-only signal, preventing it from directly modifying the data.
The card explicitly states that the `input()` function returns a "read-only signal" and that "the child cannot modify its own input." This enforces a one-way data flow from parent to child, making options suggesting two-way binding or child modification incorrect.
Read the full bite: Angular's input() Function: Passing Data to Components
Question 18 of 30
Why must every Activity, Service, BroadcastReceiver, and ContentProvider be declared in AndroidManifest.xml?
Show the answer
Answer: b · To enable the Android system to discover, instantiate, and route requests to them at install time
The manifest serves as the install-time contract with the Android system, allowing it to know what components exist and how to route intents to them. Option A is tempting because permissions are listed in the manifest, but declaring components is unrelated to runtime permission requests and the manifest is read by the system, not just used for runtime checks.
Read the full bite: What is AndroidManifest.xml and what key elements does it declare?
Question 19 of 30
You are building a responsive Figma card with Auto Layout that must fill its container width and expand vertically when the description text grows. Which setup achieves this?
Show the answer
Answer: c · Nest the headline and description in a vertical Auto Layout frame with hug height, set the parent card to hug contents vertically and fill container horizontally, and set the image to fill width
Nesting the text in a hug-height frame allows the parent to expand vertically as copy grows, while fill-width on the image and fill-container on the parent handle horizontal responsiveness. Option D is tempting because fixed height seems to help grid alignment, but it prevents the card from growing and will clip content when the text expands.
Read the full bite: How do you build a responsive card with Auto Layout?
Question 20 of 30
Which best explains why two-way binding syntax in Vue and Angular is considered syntactic sugar rather than true bidirectional flow?
Show the answer
Answer: a · It expands into a one-way property binding plus an event binding so the parent can update its own state.
v-model sugars value and input while ngModel sugars a property binding and ngModelChange, preserving unidirectional data flow by requiring the parent to handle the event and mutate canonical state. The first option is wrong because the child never directly mutates the parent; it only emits a change notification.
Read the full bite: What bindings do v-model and ngModel sugar, and why?
Question 21 of 30
Which configuration lets a Figma button with an icon and text automatically resize when the label changes?
Show the answer
Answer: b · Apply horizontal auto layout, set text and frame to hug contents, and use fixed padding
Horizontal auto layout with hug contents on the text and parent frame lets the button expand or shrink dynamically as the label changes, while fixed padding keeps spacing consistent. Grouping layers and manually nudging them is wrong because the layout breaks as soon as the text is edited, defeating the purpose of a responsive component.
Read the full bite: How would you use Auto Layout for a button with optional icon?
Question 22 of 30
When content is projected into a Vue slot, what is true regarding its data scope?
Show the answer
Answer: c · It can access data properties defined within the parent component that provides the content.
The card explicitly states that "the slot content is defined in the parent, so it has access to the parent's data scope, not the child's." This means expressions within the slot content resolve against the parent's data, not the child's.
Read the full bite: Vue Slots: Projecting Content into Components
Question 23 of 30
In a reusable DataList component, what is the primary architectural benefit of using scoped slots instead of having the parent manage the iteration?
Show the answer
Answer: a · It allows the child to own data fetching, filtering, and iteration while the parent controls only the visual template for each row.
Scoped slots preserve encapsulation by keeping data fetching and iteration inside the child while letting the parent determine markup. Option C is a common misconception because slot content uses lexical scope and cannot see child data unless the child explicitly exposes it through slot props or template context.
Read the full bite: Implement a scoped slot pattern in a reusable DataList
Question 24 of 30
Which scenario best illustrates a situation where a React controlled component is the most appropriate choice?
Show the answer
Answer: b · Creating a search bar that provides real-time suggestions as the user types.
A search bar with live suggestions requires the input's value to be constantly monitored and updated in React state to trigger suggestion fetching and rendering, which is a key characteristic of controlled components. A basic form only needing values on submission is a prime use case for uncontrolled components, as React doesn't need to manage the input's state continuously.
Read the full bite: React's Controlled vs. Uncontrolled Components
Question 25 of 30
Which statement accurately describes a critical behavior or limitation of Angular's ng-content?
Show the answer
Answer: c · It always instantiates and renders the projected content, even if the ng-content element is hidden by a conditional directive.
The card explicitly warns that 'Angular always instantiates the projected content, even if the <ng-content> tag is inside a hidden block,' making it a performance concern with conditional directives. A common misconception is that conditional directives like @if would prevent rendering, but for projected content, this is not the case.
Read the full bite: Angular Content Projection with ng-content
Question 26 of 30
Which method correctly architects a responsive Figma nav bar to preserve component links and handle breakpoint-specific layouts without detaching instances?
Show the answer
Answer: c · Create one component set with variants, horizontal Auto Layout with wrap for links, and a nested vertical overlay for mobile.
A single variant-driven component set with Auto Layout preserves maintainability and link propagation across states, whereas creating separate components breaks those links and creates maintenance debt.
Read the full bite: Structure a responsive nav bar using variants and Auto Layout
Question 27 of 30
What is the primary benefit of using the Compound Component pattern in React?
Show the answer
Answer: b · It provides a declarative API for complex UI, where a parent manages shared state for its nested children.
The Compound Component pattern's main advantage is offering a clean, declarative API for complex UI by centralizing shared state and logic in a parent, which its children then consume. Option A is incorrect because children in this pattern are coupled to the parent's state via context, not independent.
Read the full bite: Compound Components: Build Flexible APIs via Shared State
Question 28 of 30
When would you primarily use Svelte slot props?
Show the answer
Answer: d · To enable a generic child component to provide data for each item, letting the parent customize the rendering of those items.
Slot props allow a child component to pass its internal data up to the parent for custom rendering, enabling the parent to control the presentation of items managed by the child. Option A describes the inverse control flow, where the child defines rendering and the parent supplies data, which is not the primary purpose of slot props.
Read the full bite: Svelte Slot Props: Child Informs, Parent Renders
Question 29 of 30
You need a single button instance to switch between default, hover, and disabled states automatically. What should you do?
Show the answer
Answer: a · Build a component set with a State property and wire Change to interactions between variants
Component sets group related states under one property, and Change to interactions let an instance switch variants automatically without manual swaps. Option B is wrong because separate components create duplication and require designers to swap instances by hand, which is exactly the red flag the card warns against.
Read the full bite: Create a button component with default, hover, and disabled variants
Question 30 of 30
Which scenario represents an anti-pattern when utilizing Angular's ViewEncapsulation.None?
Show the answer
Answer: d · Overriding the default styles of a child component directly from its parent component.
The card explicitly states, "Do not use ViewEncapsulation.None to override a child component's styles from a parent. This is an anti-pattern." Option C describes a valid, albeit sparing, use case for None. Options C and D relate to considerations for ShadowDom encapsulation, not None.
Read the full bite: Angular View Encapsulation: Walling Off Your Component Styles
Could you explain these out loud?
That is what an interview actually tests. Tezvyn gives you questions like these with what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.