skip to content

UI Framework Concepts

What any component runtime must do: hold a tree of instances, notice a change, recompute the least output, commit it to host nodes, then route, load and submit. Interviews probe this, not one API.

on this pageshow

explore

questions

213 · 7 sections

In a component tree, what is an ancestor-provided value and what problem does it solve?

level: juniorimportance: must knowfreq 72%
basics
~20 s

A value an ancestor publishes to its whole subtree so any descendant can read it where it is used, instead of every component on the path accepting and forwarding an input it does not need.

open as a page

In a component framework, what does a default content slot do, and who owns the content that lands in it?

level: juniorimportance: must knowfreq 78%
basics
~20 s

A default content slot is a placeholder where a component renders whatever content its caller passed between its tags. The caller writes and owns that content; the component only chooses where, and whether, it appears.

open as a page

What is a host-node reference in a component framework, and when is it safe to read?

level: juniorimportance: must knowfreq 72%
basics
~20 s

A host-node reference is a container the framework fills with the real node it created for a rendered element, so code can focus, scroll or measure it. It is empty while output is described and filled once that output is committed.

open as a page

In a component framework, what are a component's declared inputs, and why must the child treat them as read-only?

level: juniorimportance: must knowfreq 85%
basics
~20 s

Declared inputs are the named values a parent passes into a child to parameterize it. The parent owns each one and re-supplies it every render, so the child only reads: a write there never reaches the owner.

open as a page

In a component framework, what is the difference between a component's definition, a live instance, and the output it produces?

level: juniorimportance: must knowfreq 76%
basics
~20 s

A definition is the reusable recipe: a function, a class or a compiled template. An instance is one live copy created where that definition is used, owning its own state. The output is the description the instance produces each update.

open as a page

In a component framework, what does deriving a value from state during render mean, and why is it the default?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Deriving means recomputing the value from current state on each render and storing nothing. It is the default because a recomputed value cannot disagree with its inputs; a cache is an optimisation for where it measurably pays.

open as a page

In a component framework, what is an effect, and when does the cleanup it registers run?

level: juniorimportance: must knowfreq 74%
basics
~20 s

An effect is code a component framework runs after a state change so something outside the component agrees with the new state - a timer, a listener, the document title. Its cleanup runs before each re-run and once at teardown.

open as a page

When a runtime compares each new state value with the previous one by reference, why is an in-place mutation invisible?

level: juniorimportance: must knowfreq 80%
basics
~20 s

Reference comparison asks only whether the new value is the same object as the old one. Writing into a field changes contents but not identity, so the comparison answers "same" and dependent work is skipped. A fresh copy makes it visible.

open as a page

In a component framework, where should a value live when two sibling components both need to read and change it?

level: juniorimportance: must knowfreq 82%
basics
~20 s

The lowest common ancestor of both siblings should own it: that component holds the value, passes the current value down as an input to each sibling, and passes down a function each sibling calls to request a change.

open as a page

When component state is assigned a new value, how does a UI framework find out that anything changed?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Nothing announces a bare assignment. Either the write goes through code the runtime owns - a setter, a tracked handle, or an assignment a compiler rewrote - or the runtime re-checks values later at a moment it was told about.

open as a page

After a framework has worked out what changed, what does the commit pass do, and why does it run uninterrupted?

level: juniorimportance: must knowfreq 62%
basics
~20 s

Commit is the apply step. It writes the already-computed changes into the host tree — creating, updating, moving and removing nodes, then wiring references and listeners — as one pass, so nobody ever sees a half-applied screen.

open as a page

A runtime re-describes a whole screen on each state change, yet only one text node changes — what happens in between?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Describing the output is cheap in-memory work. The runtime then decides which parts of that description differ from the previous update and turns only those differences into host operations, so one text write reaches the document.

open as a page

In a component framework, what is an error boundary, and what happens when a component below it throws while rendering?

level: juniorimportance: must knowfreq 72%
basics
~20 s

An error boundary is an ancestor that catches a throw raised while the runtime renders or commits its subtree, renders a fallback in that subtree's place, and leaves the rest of the application mounted and usable.

open as a page

When a component framework re-renders a list of children, what does giving each child a key taken from the data do?

level: juniorimportance: must knowfreq 84%
basics
~20 s

A key tells the runtime which previously rendered child each new child is. Without one it pairs children by position, so inserting, removing or reordering items leaves per-item state, focus and host nodes behind at the old slot.

open as a page

In a component framework, what is the difference between describing output with a compiled template and with a render function?

level: juniorimportance: must knowfreq 72%
basics
~20 s

A template is declarative markup with its own syntax for expressions, conditionals and loops, compiled ahead of time into render code. A render function returns the same description from ordinary code, using the host language's control flow.

open as a page

In a client-side router, what is a route guard and what verdicts can it return for a pending navigation?

level: juniorimportance: must knowfreq 68%
basics
~20 s

A route guard is a check the router runs before committing a navigation. It can let the navigation proceed, redirect it elsewhere such as a sign-in screen, or cancel it and leave the current screen up.

open as a page

In a client-side router, what does it mean for a route entry to name a module loader instead of a component?

level: juniorimportance: must knowfreq 72%
basics
~20 s

The table stores a function that fetches that route's code on demand rather than a component the start-up bundle already contains. The router calls it on the first navigation that matches, waits, then renders what it resolves to.

open as a page

In a client-side router with nested routes, what does the outlet a parent route renders actually do?

level: juniorimportance: must knowfreq 66%
basics
~20 s

An outlet is a marked position a parent route's component renders, and the router mounts whichever child route matched the deeper part of the URL into that position. The parent draws the shared chrome around it.

open as a page

In a client-rendered application, which parts of a screen's state belong in the URL and which must not?

level: juniorimportance: must knowfreq 78%
basics
~20 s

The URL should carry state a user could reasonably share, bookmark or reach again with the Back button: the view, the selected entity, filters, sort and page. Transient interface state, secrets and large payloads stay in memory.

open as a page

Which on-screen states must a component that loads data from a server render, besides the successful result?

level: juniorimportance: must knowfreq 78%
basics
~20 s

Besides the data, a remote-data component needs branches for idle, loading, failure, and a successful response that carried nothing. Each is a different sentence to the user; collapsing them into one blank region is the usual bug.

open as a page

If a component starts its data request only after it has rendered once, what does the user wait for?

level: juniorimportance: must knowfreq 68%
basics
~20 s

The first render happens with no data, because the request only starts once the component exists. The user waits for that dataless frame plus a full round trip, and every nested component that fetches repeats the pattern.

open as a page

When a component triggers a write to the server, which states does that write pass through, and why disable the trigger while it is pending?

level: juniorimportance: must knowfreq 72%
basics
~20 s

A write passes through idle, pending, then success or failure, and the component renders each. Disabling the trigger while pending stops a duplicate write the server may apply twice, whose two responses can also land in either order.

open as a page

When a component starts a request on every keystroke in a text field, how do debouncing and throttling differ?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Debouncing waits for a quiet gap after the last keystroke and then fires once; throttling fires at a fixed maximum rate while typing continues. A search field wants debouncing, because only the settled query matters.

open as a page

For a client-side cache of server data keyed by the request, what does a stale entry mean and what does a reader get?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Stale means the entry is still usable but no longer trusted to match the server. A reader gets the cached value immediately as data, not as loading, while the cache refetches behind it and re-renders on arrival.

open as a page

In a component framework, what makes a text field's value framework-held rather than element-held?

level: juniorimportance: must knowfreq 80%
basics
~20 s

A field is framework-held when the component renders its text from state and every edit writes state back, so state is the authority. Element-held means the host element keeps the text and the framework reads it only when needed.

open as a page

Which host event does a text field's two-way binding usually listen to, and what changes if it listens for the committed change instead?

level: juniorimportance: must knowfreq 72%
basics
~20 s

A text binding normally listens to the per-edit input event, which fires on every accepted edit, so the model tracks the field continuously. Bound to the committed change event instead, the framework learns the value only when the field commits.

open as a page

While a form's submit request is in flight, what must the form show the user and why disable its submit control?

level: juniorimportance: must knowfreq 70%
basics
~10 s

It must show a pending state: the submit control disabled or marked busy, values still on screen, nothing claimed as saved. Without it the user presses again and the same payload is written twice.

open as a page

In a form, what are the moments a validation rule can run - submit, blur, or change - and how does each choice change the form's feel?

level: juniorimportance: must knowfreq 76%
basics
~20 s

A rule can run when the form is submitted, when a field loses focus, on every value change, or on change only after a submit has failed. Later timing feels calmer; earlier timing corrects sooner but interrupts typing.

open as a page

A field rendered from component state ignores every keystroke and keeps showing the same text — what is broken?

level: middleimportance: must knowfreq 72%
basics
~20 s

State is the authority for the field's text, but nothing writes the edit back into it, so the next render restores the old value. Either write state on input, or stop rendering the value from state.

open as a page

In a component test, what does replacing real time with a fake clock make testable that a real delay cannot?

level: juniorimportance: must knowfreq 58%
basics
~20 s

A fake clock turns waiting into an explicit step: the test moves time forward itself, so a debounce window, a poll interval, a timeout branch or a retry delay is reached instantly and identically on every run.

open as a page

A component test fails to mount because the tree reads values from ancestors it does not have. What must the test supply?

level: juniorimportance: must knowfreq 60%
basics
~20 s

Everything the tree reads from above it: the ancestor-provided values it expects (theme, locale, session), a router, any external store it subscribes to, and a data client. The test wraps the component in those providers before mounting.

open as a page

In a component test, why does assigning a bound text control's value property leave the component's state unchanged?

level: juniorimportance: must knowfreq 68%
basics
~20 s

A binding is a listener the framework registered on that control for one host event, so writing the element's value property only changes the control and dispatches nothing. The listener never runs, and state keeps the old value.

open as a page

In a component test, what does mounting a tree into a test host mean, and what does the root handle it returns let you do?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Mounting attaches a component tree to a host the test owns — usually a container the test created in a simulated document — and returns a root handle. Through it the test queries rendered output, feeds new inputs into the same root, and tears the tree down.

open as a page

With time faked in a component test, why must the clock be advanced and the framework's update queue settled separately?

level: middleimportance: must knowfreq 56%
basics
~20 s

They are two different queues with two different triggers. Advancing the clock fires timer callbacks, and those callbacks only write state; turning a write into committed output is the framework's settle step. Advance, settle, then assert - once per link.

open as a page