Skip to main content

Installation

npm i @cuple/react

Requires React 19 and @cuple/client.

Setup​

Create a store next to your client:

export const client = createClient<typeof routes>({ path: "/rpc" });
export const store = createCupleStore();

Provide it once, at the root, with a <Boundary> around what loads:

export function App() {
return (
<CupleProvider store={store}>
<Boundary
fallback={<TodoListSkeleton />}
error={(error, retry) => (
<p>
{error.message}{" "}
<button type="button" onClick={retry}>
Retry
</button>
</p>
)}
>
<TodoList />
</Boundary>
</CupleProvider>
);
}

<Boundary> shows its fallback while anything inside it loads, and its error when something inside it fails.

That's all. Read data with useGet, and change it with useAction.

To run this todo app: cd examples/docs && npm run dev:todos.