Skip to main content

Function: useItem()

Call Signature​

useItem<S>(...pathComps): ManagedItem<S, Schema>

Defined in: react/hooks.ts:83

This hook monitors changes to a specific item, triggering a re-render whenever the item's state changes. It returns a mutable ManagedItem instance that allows direct editing. Any changes to the item are automatically queued for background commit and synchronization with the server. Similar to the useQuery hook, useItem reacts to both local and remote updates.

Type Parameters​

Type Parameter
S extends Schema

Parameters​

ParameterTypeDescription
...pathCompsstring[]A full item path or separate path components.

Returns​

ManagedItem<S, Schema>

A ManagedItem instance or undefined if the item doesn't exist or it's repository hadn't finished loading yet. In the latter case, the hook will automatically trigger a re-render when the repository finished loading and the item becomes available.

Call Signature​

useItem<S>(opts, ...pathCompsOrOpts): ManagedItem<S, Schema>

Defined in: react/hooks.ts:103

This hook monitors changes to a specific item, triggering a re-render whenever the item's state changes. It returns a mutable ManagedItem instance that allows direct editing. Any changes to the item are automatically queued for background commit and synchronization with the server. Similar to the useQuery hook, useItem reacts to both local and remote updates.

Type Parameters​

Type Parameter
S extends Schema

Parameters​

ParameterTypeDescription
optsUseItemOptsOptions object for configuring this hook.
...pathCompsOrOptsstring[]A full item path or separate path components.

Returns​

ManagedItem<S, Schema>

A ManagedItem instance or undefined if the item doesn't exist or it's repository hadn't finished loading yet. In the latter case, the hook will automatically trigger a re-render when the repository finished loading and the item becomes available.

Call Signature​

useItem<S>(path, opts): ManagedItem<S, Schema>

Defined in: react/hooks.ts:125

This hook monitors changes to a specific item, triggering a re-render whenever the item's state changes. It returns a mutable ManagedItem instance that allows direct editing. Any changes to the item are automatically queued for background commit and synchronization with the server. Similar to the useQuery hook, useItem reacts to both local and remote updates.

Type Parameters​

Type Parameter
S extends Schema

Parameters​

ParameterTypeDescription
pathstringA full item path. If the path is undefined, the returned item will also be undefined.
optsUseItemOptsOptions object for configuring this hook.

Returns​

ManagedItem<S, Schema>

A ManagedItem instance or undefined if the item doesn't exist or it's repository hadn't finished loading yet. In the latter case, the hook will automatically trigger a re-render when the repository finished loading and the item becomes available.

Call Signature​

useItem<S>(path, opts): undefined

Defined in: react/hooks.ts:147

This hook monitors changes to a specific item, triggering a re-render whenever the item's state changes. It returns a mutable ManagedItem instance that allows direct editing. Any changes to the item are automatically queued for background commit and synchronization with the server. Similar to the useQuery hook, useItem reacts to both local and remote updates.

Type Parameters​

Type Parameter
S extends Schema

Parameters​

ParameterTypeDescription
pathundefinedA full item path. If the path is undefined, the returned item will also be undefined.
optsUseItemOptsOptions object for configuring this hook.

Returns​

undefined

A ManagedItem instance or undefined if the item doesn't exist or it's repository hadn't finished loading yet. In the latter case, the hook will automatically trigger a re-render when the repository finished loading and the item becomes available.

Call Signature​

useItem<S>(path): ManagedItem<S, Schema>

Defined in: react/hooks.ts:168

This hook monitors changes to a specific item, triggering a re-render whenever the item's state changes. It returns a mutable ManagedItem instance that allows direct editing. Any changes to the item are automatically queued for background commit and synchronization with the server. Similar to the useQuery hook, useItem reacts to both local and remote updates.

Type Parameters​

Type Parameter
S extends Schema

Parameters​

ParameterTypeDescription
pathstringA full item path. If the path is undefined, the returned item will also be undefined.

Returns​

ManagedItem<S, Schema>

A ManagedItem instance or undefined if the item doesn't exist or it's repository hadn't finished loading yet. In the latter case, the hook will automatically trigger a re-render when the repository finished loading and the item becomes available.

Call Signature​

useItem<S>(path): undefined

Defined in: react/hooks.ts:188

This hook monitors changes to a specific item, triggering a re-render whenever the item's state changes. It returns a mutable ManagedItem instance that allows direct editing. Any changes to the item are automatically queued for background commit and synchronization with the server. Similar to the useQuery hook, useItem reacts to both local and remote updates.

Type Parameters​

Type Parameter
S extends Schema

Parameters​

ParameterTypeDescription
pathundefinedA full item path. If the path is undefined, the returned item will also be undefined.

Returns​

undefined

A ManagedItem instance or undefined if the item doesn't exist or it's repository hadn't finished loading yet. In the latter case, the hook will automatically trigger a re-render when the repository finished loading and the item becomes available.

Call Signature​

useItem<S>(item, opts): ManagedItem<S, Schema>

Defined in: react/hooks.ts:206

This hook monitors changes to a specific item, triggering a re-render whenever the item's state changes. It returns a mutable ManagedItem instance that allows direct editing. Any changes to the item are automatically queued for background commit and synchronization with the server. Similar to the useQuery hook, useItem reacts to both local and remote updates.

Type Parameters​

Type Parameter
S extends Schema

Parameters​

ParameterTypeDescription
itemManagedItem<S, Schema>The item to monitor. If undefined, the returned item will also be undefined.
optsUseItemOptsOptions object for configuring this hook.

Returns​

ManagedItem<S, Schema>

The given ManagedItem instance.

Call Signature​

useItem<S>(item): ManagedItem<S, Schema>

Defined in: react/hooks.ts:224

This hook monitors changes to a specific item, triggering a re-render whenever the item's state changes. It returns a mutable ManagedItem instance that allows direct editing. Any changes to the item are automatically queued for background commit and synchronization with the server. Similar to the useQuery hook, useItem reacts to both local and remote updates.

Type Parameters​

Type Parameter
S extends Schema

Parameters​

ParameterTypeDescription
itemManagedItem<S, Schema>The item to monitor. If undefined, the returned item will also be undefined.

Returns​

ManagedItem<S, Schema>

The given ManagedItem instance.

Call Signature​

useItem<S>(item, opts): ManagedItem<S>

Defined in: react/hooks.ts:241

This hook monitors changes to a specific item, triggering a re-render whenever the item's state changes. It returns a mutable ManagedItem instance that allows direct editing. Any changes to the item are automatically queued for background commit and synchronization with the server. Similar to the useQuery hook, useItem reacts to both local and remote updates.

Type Parameters​

Type Parameter
S extends Schema

Parameters​

ParameterTypeDescription
itemManagedItem<S>The item to monitor.
optsUseItemOptsOptions object for configuring this hook.

Returns​

ManagedItem<S>

The given ManagedItem instance.

Call Signature​

useItem<S>(item): ManagedItem<S>

Defined in: react/hooks.ts:258

This hook monitors changes to a specific item, triggering a re-render whenever the item's state changes. It returns a mutable ManagedItem instance that allows direct editing. Any changes to the item are automatically queued for background commit and synchronization with the server. Similar to the useQuery hook, useItem reacts to both local and remote updates.

Type Parameters​

Type Parameter
S extends Schema

Parameters​

ParameterTypeDescription
itemManagedItem<S>The item to monitor.

Returns​

ManagedItem<S>

The given ManagedItem instance.