Skip to content

React

Once your backend has a command to submit or a query to read, use its generated proxy in a React component. Arc’s .use() hooks connect those typed contracts to rendering, so the component does not need its own HTTP client or duplicate request types.

First generate the proxies and configure Arc above the components that use them. For a live author list, the observable query example uses this hook inside a component:

const [authors] = AllAuthors.use();

AllAuthors is the generated query proxy; authors is its result state, with the current models in .data. The hook subscribes to the configured backend source and re-renders when it emits. Use an ordinary query instead when the screen only needs a one-off read.

Query results expose isPerforming for loading state. For commands, manage pending state in the component or use a form component; the command hook does not disable a submit button while a request is pending. Start with commands to submit a change or queries to display data.

Topic What it covers
Commands The .use() hook — instantiate, bind, validate, and execute a command from a component.
Command Validation Pre-flight feedback from client checks and the backend validation endpoint, without executing the handler.
Command Scopes A scope that captures changes, validation, and errors across several commands in one UI.
Topic What it covers
Queries Reading data with .use() — including live, observable queries that re-render on change.
Topic What it covers
Configure Arc Point the React app at your backend and set transport, headers, and identity.
Identity Who the user is, and what they’re allowed to see and do.
Dialogs Consistent dialog handling for command and data-entry flows.
Proxy generation (C#) Generate the typed clients used in these C# examples. For other backends, see JVM proxies or the TypeScript backend’s generator.
Storybook The Storybook for the components Arc exposes.
Story Components Building good-looking, consistent stories.

When a screen’s behavior grows beyond its component, Model–View–ViewModel (MVVM) with React shows how to move that behavior into a testable view model.