Components
78 bites tagged Components — interview questions with model answers, and 60-second explainers.
Explain the difference between a Main Component and an Instance in Figma
Tests your grasp of Figma's component architecture and update flow. A Main Component is the source of truth; an Instance is a linked copy inheriting its properties. Edits update Instances except overridden values.
Difference between detaching and pushing overrides to main?
Tests component governance: detaching severs the link for local one-offs, while pushing overrides sends instance changes back to the main component globally. Strong answers contrast local versus library-wide scope and name specific scenarios.
Main components vs instances: how to use Component Properties for multi-state Buttons?
This tests Figma component architecture. A main component is the source; an instance is a linked copy. Use variant properties for state and style, plus booleans for optional layers. Red flags: separate components per state or ignoring property controls.
How would you use Auto Layout to build a responsive card?
Tests Figma Auto Layout direction, padding, and resizing rules. Answer: stack header, image, and text vertically with a fixed gap; set text to fill width and hug height; wrap in a scaling frame. Red flag: absolute positioning instead of structured Auto Layout.
Why use button variants instead of separate components per state?
Tests Figma component set organization and scalability. Strong answers cite flexible property mixing, reduced combinatorial bloat, and cleaner dev handoff. Red flag: saying only "it's cleaner" without naming navigability or system integrity.
How do you populate one overlay for three profiles using variables?
Tests Figma variables and advanced prototyping. Use Set variable actions on each profile to update a string variable bound to a single overlay's name, plus instance swap for the avatar, then open that overlay.
Create a button component with default, hover, and disabled variants
This tests Figma component variants and prototyping. A good answer: create a component set with a State property, build default, hover, and disabled variants, wire Change to with While hovering. Red flag: separate components instead of one variant set.
Structure a responsive nav bar using variants and Auto Layout
One component set with desktop/mobile variants; horizontal Auto Layout with wrap for links, then hamburger and vertical overlay. Tests component architecture and responsive layout. Using separate components instead of variant-driven states.
How would you use Auto Layout for a button with optional icon?
This tests Figma Auto Layout for responsive components. Answer: apply horizontal auto layout, set fixed padding and spacing, set text to hug contents, and set the frame to hug so it resizes when text changes. Red flag: using fixed widths or manual resizing.
How do you build a responsive card with Auto Layout?
Tests nested Auto Layout and resizing logic. Answer: vertical hug frame, nested vertical text stack with hug height, image set to fill width, plus padding. Red flag: fixed-height text or absolute positioning breaks responsiveness.
Boolean Component Properties in Figma
Boolean properties in Figma are light switches for layers inside a component. They let you toggle an icon or badge on and off without spawning extra variants. The catch is that hiding a layer can break auto-layout if that layer was anchoring spacing.
Component Properties: Levers Without Variants
Component properties are levers that let you swap text, toggle layers, or change icons without detaching. They shine in buttons with optional icons. The footgun is adding so many toggles that the panel becomes harder to use than a tidy variant grid.
Components: One Master, Many Instances
A component is a master spawning linked copies; edit it and all copies update instantly. Use them for buttons and cards that repeat so one edit flows everywhere. Detach instances or override everything and you kill reusability, forcing manual fixes.
Explain controlled vs uncontrolled React form inputs and trade-offs
Tests state versus DOM ownership. Controlled inputs bind to React state via onChange; uncontrolled inputs read from DOM via refs. Trade-offs: reactivity, validation, complexity. Red flag: saying uncontrolled is easier while ignoring lost live validation.
Describe two patterns for conditional rendering in JSX
First, early return with if/else for branches; second, ternary or logical AND inside JSX for inline toggles. Whether you know React conditional rendering. Reaching for useState or useEffect when simple JS suffices.
What are the two main ways to define a component in React?
Tests fluency in function and class syntax. Outline: show a function returning an h1; show a class with render() returning an h1; note functions are the React 19 default. Red flag: offering arrow vs function declaration as the two ways, or omitting render().
Card Pattern: Self-Contained Content Objects
A card groups related info into a bounded, scannable object you can rearrange like playing cards. Use it for dashboards, product grids, or feeds where items need equal visual weight.
CSS-in-JS: Scoped Styles via JavaScript
CSS-in-JS lets components own their styles in JavaScript, generating CSS and injecting it into the DOM at runtime. It prevents global namespace collisions in component frameworks. The footgun is runtime overhead and bigger bundles.
What is AndroidManifest.xml and what key elements does it declare?
This tests your grasp of the system-app contract. Good answers cover component registration, permissions, and build metadata like package name and target SDK. A red flag is omitting install-time system discovery.
Angular's ng-template: Reusable UI Blueprints
ng-template defines a reusable UI blueprint that isn't rendered by default. Use it with ngTemplateOutlet to create configurable components, like passing a custom item layout to a generic list.
Vue Single-File Components (SFCs)
Vue's Single-File Components (SFCs) bundle a component's template, logic, and styles into one `.vue` file. A build tool compiles this into browser-readable JS and CSS, turning your template into optimized render functions.
Angular's TestBed: A Sandbox for Component Testing
Angular's TestBed creates a mini-app just for your test, letting you check how a component renders and behaves with mock dependencies. It's for testing component-template interactions in isolation.
Component v-model: Two-Way Binding with defineModel
v-model on a component creates a two-way binding, letting a parent and child share and update data. The `defineModel()` macro is the modern way to enable this for custom form inputs. The footgun is that a `default` value can de-sync parent/child state.
Vue Dynamic Components: Swap Components on the Fly
Use Vue's `<component :is="...">` element to render different components based on a state variable, like swapping views in a tabbed interface. The footgun: components are destroyed on switch; use `<KeepAlive>` to preserve their state and avoid losing user…
Get Components bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
Open testing — you’ll join as an early tester.