brust 2.0.0-alpha.66
React & libraries / React coverage

React coverage

Each React API, and what brust does with it: lowered to native code, rendered once as static markup, or left to React as an island. Every row is a case the test battery builds and checks.

Summary

58 entries from the React reference (react.dev, fetched 2026-10-13): 12 native, 12 static, 24 island, 5 partial, 5 not applicable.

  • Native: compiled to a template the server fills and a binding the browser updates; no React in the browser.
  • Static: rendered once; the page ships the markup and nothing else.
  • React island: the component runs in React, rendered by the worker and hydrated in the browser. The rest of the page keeps its tier.
  • Partial: some shapes of the API are native or static and others are islands; the note says which.
  • Not applicable: the API has no meaning in brust (there is no Server Components runtime).

Early returns and switch

A component body may choose what it returns with an early-return chain, if (a) return A and so on down to a last return, or with a switch on a prop, a state value or a member path such as item.type, when every case ends in return. Stacked cases (case 'a': case 'b':) and a default are fine, and a default may throw new Error with a literal message. Cases compare with ===, so the string '1' does not match the number 1. The tier follows the discriminant like any condition: props only keeps the page static, state makes the choice follow the clicks.

A switch that could fall through, leave with break, declare a const outside braces, or test something that is not a literal stays a React island, and the build names it switch-fallthrough. End every case with return to keep it native or static.

However long the chain, each case is printed once. Conditionals nested inside one another are different: a level that follows state, a store or a list row prints both of its branches, so what sits under it doubles. A component whose nested conditionals and lists print more than 8 MiB of such copies stops the build with reactive-if-depth, naming the component and the depth. Turn the nesting into one if / else if chain or switch, or compute the choice into one value first.

Lists

A list is items.map(callback) or Array.from(items, callback), where the callback returns JSX with a key. The item may be a name or a flat pattern, ({ id, name: label }) => or ([key, , value]) =>; the index, when there is one, is a name. The body may be one expression, or a block of const name = value; and if (cond) return null; statements before one return <li …/>. A row const may read the item, the index, props, state, the consts above it and helper functions.

brust does not keep a row const as a variable: each place that reads it reads its value. React computes the value once per row, brust where it is read, so a const read twice calls its helper twice. For a render that is pure and does not throw, the output is the same.

Four kinds of callback stay a React island, and the build names them list-shape with the reason: an item pattern with a default value, a nested pattern, a rest element or a computed key, or a pattern as the index; a row binding that is let, var or a pattern, or a const that holds JSX or calls a hook; an early return other than return null; and a row const read where a nested list or a function declares a name its value reads (rename that inner name). items?.map(…) stays an island too.

Component body and custom hooks

The component body may destructure a value with a flat pattern: const { kind, m: msg } = ask or const [first, , third] = pair. Over a path of props, state, a store view or another body const, each name reads its member of that path. Over anything else, such as a call, the value is computed once and each name reads its member of the result. A default, a nested pattern, a rest element or a computed key in the pattern keeps the component a React island, and the build names it body-shape with the reason. So does a destructured name read where a nested list or a function declares a name its value reads.

A custom hook may be imported through a module that only re-exports it: export { useX } from './x', import { useX } from './x'; export { useX } (renamed too) or export * from './x', up to four modules deep. Its module's other exports are then imported from the module that declares the hook. A hook parameter may have a default, such as function useFocus(selector = 'input', count?), when the default reads no other parameter and calls nothing: a call that leaves the argument out, or passes undefined, gets the default, as in React. A default that reads a parameter or calls a function keeps the hook-shape finding, which names the parameter.

Hooks

EntryTierNote
useActionStateReact islandany hook outside the supported hooks hook-unsupported
useCallbackNative
useContextStaticR34.142: a context with a literal default read as a value, with no Provider above the page, is its default (React's own rule)
useDebugValueReact islandany hook outside the supported hooks hook-unsupported
useDeferredValueReact islandany hook outside the supported hooks hook-unsupported
useEffectNativeeffect-deps: the deps array is complete, so no warning () effect-deps
useEffectEventReact islandany hook outside the supported hooks hook-unsupported
useIdStaticuseId: the server seeds _id0 (); no state or handler, so the tier is static
useImperativeHandleReact islandany hook outside the supported hooks hook-unsupported
useInsertionEffectReact islandany hook outside the supported hooks hook-unsupported
useLayoutEffectNative
useMemoNative
useOptimisticReact islandany hook outside the supported hooks hook-unsupported
useReducerNativea state cell and one stable dispatch handler (was react, hook-unsupported)
useRefNative
useStateNative
useSyncExternalStoreReact islandhook-unsupported
useTransitionReact islandstartTransition is outside the supported set hook-unsupported

Components

EntryTierNote
<Activity>React islandF148a: `mode` is an expression over props, which the server cannot hand to the island (fallback:island-prop). It read as static before only because the battery compiles without building: `brust build` failed it with ssr-prop-not-a-path (). With a plain prop or a literal mode it is a static page with the React built-in as an island (R34.21) external-component island-prop
<Fragment>Staticstatic fragment root: no <brust-host>, no warning (gaps L8)
<Profiler>Partialnative/static: d-profiler-bare; island: d-profiler external-component island-prop
<StrictMode>StaticR34.21 (F138e): the React built-in is an island and its constant children travel as JSON; the page was react only for island-children external-component
<Suspense>Partialnative/static: d-suspense-static; island: d-lazy-suspense dynamic-import external-component island-children local-component
<ViewTransition>StaticR34.21 (F138e): the React built-in is an island and its constant children travel as JSON; the page was react only for island-children external-component

APIs

EntryTierNote
actNot applicableA test helper; it has no runtime meaning in a brust page. Importing it changes nothing about a component.
addTransitionTypeReact islandaddTransitionType inside startTransition hook-unsupported
cacheStaticcache()
cacheSignalStaticcache(): the call is a precompute job on the server
captureOwnerStackReact islandcaptureOwnerStack in a handler hook-unsupported
createContextPartialnative/static: d-createcontext; island: d-createcontext-consumer member-tag jsx-const-child jsx-expression
experimental_taintObjectReferenceReact islandhook-unsupported
experimental_taintUniqueValueReact islandhook-unsupported
lazyReact islandfixed: a dynamic import() is a dynamic-import fallback, not a printer panic dynamic-import external-component island-children local-component
memoPartialnative/static: b-memo; island: d-memo-state default-export-shape
startTransitionReact islandstartTransition is outside the supported set hook-unsupported
useReact islandhook-unsupported

react-dom hooks

EntryTierNote
useFormStatusPartialnative/static: c-useformstatus-child; island: c-useformstatus; known gap: the root is static and Submit is an island, but the <form> is not a React form, so pending never becomes true; the root should be react hook-unsupported

react-dom components

EntryTierNote
<form>Native<form onSubmit>; known gap: a function action becomes a precompute value that the url_ok guard drops, so the form renders without an action and submits nowhere; it should fall back to react
<input>Nativecontrolled <input>
<select>Nativethe shadcn wrapper shape; the value is printed as selected on the matching option
<textarea>Nativethe value is printed as the text content
<title>Static<title> in a component body
<meta>Static<meta> in a component body
<link>Static<link rel=stylesheet> in a component body
<style>Static<style> element
<script>Static<script async src>

react-dom APIs

EntryTierNote
createPortalReact islandjsx-const-child browser-global
flushSyncNativeflushSync in a handler; known gap: compiles native but the client chunk imports react-dom (a native chunk must contain no react import); it should fall back to react
preconnectReact islandpreconnect in render body-shape
prefetchDNSReact islandprefetchDNS in render body-shape
preinitReact islandpreinit in render body-shape
preinitModuleReact islandpreinitModule in render body-shape
preloadReact islandpreload in render body-shape
preloadModuleReact islandpreloadModule in render body-shape

Server

EntryTierNote
'use client'Not applicableNo directives: every component is classified by the compiler. The directive is ignored with a warning. use-client-leftover
'use server'Not applicableNo directives: server work is an Elysia app under `[actions]`, or a loader/job. A `'use server'` function is not a server function here.
Server ComponentsNot applicableNo Server Components: a loader and the compiled jobs are the server half, components render to HTML on the Rust server.
Server FunctionsNot applicableNo Server Functions: call an `[actions]` route (`@brust/core/actions`) instead.