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 pageshowhide
explore
- Component Model31 questions
- Definition, Instance & Lifecycle5 questions
- Inputs & One-Way Flow5 questions
- Outputs & Upward Events6 questions
- Composition, Slots & Reuse5 questions
- Ancestor-Provided Values5 questions
- Host Access & Portals5 questions
- State & Reactivity33 questions
- State Ownership & Lifting5 questions
- Change Propagation Models6 questions
- Derived Values & Memoization5 questions
- Immutable Updates & Equality6 questions
- Stores & Subscriptions6 questions
- Effects & External Sync5 questions
- Update Cycle & Reconciliation33 questions
- Templates vs Render Functions6 questions
- Scheduling, Batching & Purity5 questions
- Minimal-Change Strategies5 questions
- Keys & Instance Identity5 questions
- Commit & Host Output6 questions
- Error Boundaries & Recovery6 questions
- Client-Side Routing35 questions
- URL as Application State5 questions
- Route Tables & Typed Params6 questions
- Nested Routes & Layout Outlets6 questions
- Navigation, History & Restoration6 questions
- Guards, Redirects & Access6 questions
- Lazy Routes & Preloading6 questions
- Remote Data33 questions
- Fetch Timing & Waterfalls5 questions
- Loading, Error & Empty States6 questions
- Request Races & Cancellation5 questions
- Server-State Cache & Staleness6 questions
- Writes & Optimistic Updates5 questions
- Live Updates & Streams6 questions
- Form Handling26 questions
- Field Value Ownership5 questions
- Input Events & Binding Semantics5 questions
- Validation Timing & Rules6 questions
- Submission & Pending State5 questions
- Dynamic & Repeating Fields5 questions
- Testing a Component Tree22 questions
- Mount Harness & Update Flush6 questions
- Wiring Providers & Stores6 questions
- Interactions Through Bindings5 questions
- Async Output & Fake Time5 questions
questions
213 · 7 sectionsIn a component tree, what is an ancestor-provided value and what problem does it solve?
basics
~20 sA 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.
In a component framework, what does a default content slot do, and who owns the content that lands in it?
basics
~20 sA 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.
What is a host-node reference in a component framework, and when is it safe to read?
basics
~20 sA 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.
In a component framework, what are a component's declared inputs, and why must the child treat them as read-only?
basics
~20 sDeclared 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.
In a component framework, what is the difference between a component's definition, a live instance, and the output it produces?
basics
~20 sA 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.
In a component framework, what does deriving a value from state during render mean, and why is it the default?
basics
~20 sDeriving 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.
In a component framework, what is an effect, and when does the cleanup it registers run?
basics
~20 sAn 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.
When a runtime compares each new state value with the previous one by reference, why is an in-place mutation invisible?
basics
~20 sReference 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.
In a component framework, where should a value live when two sibling components both need to read and change it?
basics
~20 sThe 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.
When component state is assigned a new value, how does a UI framework find out that anything changed?
basics
~20 sNothing 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.
After a framework has worked out what changed, what does the commit pass do, and why does it run uninterrupted?
basics
~20 sCommit 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.
A runtime re-describes a whole screen on each state change, yet only one text node changes — what happens in between?
basics
~20 sDescribing 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.
In a component framework, what is an error boundary, and what happens when a component below it throws while rendering?
basics
~20 sAn 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.
When a component framework re-renders a list of children, what does giving each child a key taken from the data do?
basics
~20 sA 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.
In a component framework, what is the difference between describing output with a compiled template and with a render function?
basics
~20 sA 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.
In a client-side router, what is a route guard and what verdicts can it return for a pending navigation?
basics
~20 sA 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.
In a client-side router, what does it mean for a route entry to name a module loader instead of a component?
basics
~20 sThe 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.
In a client-side router with nested routes, what does the outlet a parent route renders actually do?
basics
~20 sAn 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.
In a client-rendered application, which parts of a screen's state belong in the URL and which must not?
basics
~20 sThe 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.
Which on-screen states must a component that loads data from a server render, besides the successful result?
basics
~20 sBesides 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.
If a component starts its data request only after it has rendered once, what does the user wait for?
basics
~20 sThe 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.
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?
basics
~20 sA 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.
When a component starts a request on every keystroke in a text field, how do debouncing and throttling differ?
basics
~20 sDebouncing 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.
For a client-side cache of server data keyed by the request, what does a stale entry mean and what does a reader get?
basics
~20 sStale 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.
In a component framework, what makes a text field's value framework-held rather than element-held?
basics
~20 sA 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.
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?
basics
~20 sA 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.
While a form's submit request is in flight, what must the form show the user and why disable its submit control?
basics
~10 sIt 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.
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?
basics
~20 sA 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.
A field rendered from component state ignores every keystroke and keeps showing the same text — what is broken?
basics
~20 sState 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.
In a component test, what does replacing real time with a fake clock make testable that a real delay cannot?
basics
~20 sA 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.
A component test fails to mount because the tree reads values from ancestors it does not have. What must the test supply?
basics
~20 sEverything 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.
In a component test, why does assigning a bound text control's value property leave the component's state unchanged?
basics
~20 sA 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.
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?
basics
~20 sMounting 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.
With time faked in a component test, why must the clock be advanced and the framework's update queue settled separately?
basics
~20 sThey 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.