Hooks

LongLink supplies these hooks directly in Views, without imports or a React. prefix. Call hooks at the top level of a component, never inside conditions or loops.

longlink docs --component "Hooks"

Hooks

Hook
useState(initial)Returns the current state and a setter. Pass a value or an initializer function; updates can use the previous state.
useEffect(effect, dependencies)Synchronizes with external systems after rendering. Return a cleanup function to release timers or subscriptions. Include every reactive value used by the effect in its dependencies.
useMemo(factory, dependencies)Caches a calculated value until its dependencies change. Use it for expensive calculations, not required application state.
useRef(initial)Returns a stable object with a mutable current property. Changing current does not trigger a render.
useApi(path)Returns Solution data and an awaitable invalidator scoped to the full request path. The renderer handles initial loading, errors, and retry.