@1upvision/sdk:
useExtensionStorage
The main hook for reading and writing data. Storage is persisted on the server and syncs in real-time between all targets (editor, layer, interactive page).Basic Usage
Real-Time Sync
When you callsetStorage in any target, all other targets update automatically:
- Streamer toggles a switch in the editor panel
- The value is persisted to the server
- The OBS layer receives the update and re-renders
useVisionState
useVisionState is a key-scoped state hook backed by extension storage.
Use it when you want useState-style ergonomics without manually spreading the
entire storage object on every update.
Example
When to use which
useExtensionStorage: when you want to read/write the whole storage objectuseVisionState: when you want one key withuseState-style updates
useExtensionContext
Returns metadata about the running extension instance. Useful for rendering different UIs per target or for debugging.null until the extension is initialized, then:
Build an Interactive Link
Render Different UI per Target
useQuery and useMutation
If your extension uses server functions, two additional hooks are available for calling them from the client:useQuery
Calls a server query function by name. Returns the data, loading state, and error.useMutation
Calls a server mutation or action function by name. Automatically invalidates active queries on success.Which hook for which function type
See Server Functions for full details on defining functions.