react-call v2

Root & Stack

One Root mounts the Callable in your React tree. Many calls can be active at once — the Root renders all of them as a stack.

Two roles, one component

A Callable (the value returned by createCallable) is two things at once. It is a React component you mount — that mount is the Root. And it is a namespace of imperative methods — call, upsert, end, update. The Root listens; the methods speak.

The Stack

Every .call(…) adds an active Call to the Stack. The Root renders all of them, in insertion order. There is no cancellation, no replace-by-default — newer calls coexist with older ones until each is explicitly ended.

0 / 5
click "Open another" to start a call

Each call carries its own CallContext, and closing one does not affect the others. That is what makes recursion natural to model — a confirm that opens another confirm is just two calls on the same Stack.

One Root per Callable

Mount the bare component (<Confirm />) once, anywhere visible. Two mounts of the same Callable will throw at .call() time — it is a programmer error, not a runtime fallback.

As many Callables as you want

One Root per Callable — but you can have as many Callables as your app needs. A Confirm, a Toast, a Drawer, a Lightbox: each is its own Root with its own Stack, mounted side by side near the top of your tree.

They never collide. There is no shared registry, no z-index coordinator, no provider that has to know about every dialog in advance. Each Callable owns its own little world and ignores the rest — so adding the tenth interactive surface to an app is exactly as simple as adding the first.