React
@junjo/react is the React-specific layer built on top of @junjo/sdk. It wires a single Junjo client through React Context and exposes hooks that consume it.
Install
npm install @junjo/sdk @junjo/reactreact is a peer dependency (^18 or ^19); the package brings no React copy of its own.
Hooks and components
| Hook / component | Description |
|---|---|
JunjoProvider | Provides a Junjo client to the subtree via context. |
useJunjo | Returns the provided client from any descendant component. |
useGroup | Snapshot + live event stream for one group’s metadata and active members. |
useCan | Boolean permission check with a per-provider shared cache. |
useMembers | Paginated roster with status filter and live event updates. |
useInvitations | Paginated invitation list with status filter and live event updates. |
useAuditLog | Paginated audit log with action filter; refetch-driven (no SSE subscription). |
useMutation | Generic mutation primitive with onMutate -> context -> onError rollback hooks for optimistic updates. |
applyOptimistic on useMembers / useInvitations / useGroup | Each hook’s result returns a snapshot + rollback helper that pairs with useMutation. |
Wiring JunjoProvider once at your app’s root is the only setup step you need.