Shape of the stored object (defaults to Record<string, ValueType>)
NonLocalStorage instance id (room/store id)
Key identifying the stored object
Hook options (credentials, instanceOptions, bind)
A tuple:
Example: const [user, { merge, setIn, setObject }, error, isLoading] = useNonLocalObject<{ name?:string, profile?:{ avatar?:string } }>('room1', 'user', { credentials: {...} })
// shallow merge await merge({ name: 'Alice' })
// set nested await setIn('profile.avatar', 'avatar.jpg')
// replace whole object await setObject({ name: 'Alice', profile: { avatar: 'avatar.jpg' } })
React hook for managing an object stored in NonLocalStorage with atomic helpers.
This hook exposes a reactive object value plus an actions object that provides atomic operations implemented by the underlying @vaultrice/sdk NonLocalStorage:
The hook keeps local state in sync with remote updates (unless options.bind === false), returns any operation errors and exposes an isLoading flag for initial load / async ops.