ReactNamespace
The React half of a namespace: the same hooks, with every bus name prefixed.
Options keep their meaning — store and name are still relative names, and
scope still says how far a value travels, which is a different axis from
which namespace it lives in.
Extends
Section titled “Extends”Properties
Section titled “Properties”readonly name: string;The prefix every name from this namespace carries.
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”busName()
Section titled “busName()”busName(name?): string;What a bare name becomes here. Exposed so devtools, observeBus and tests can name the same bus.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name? | string |
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”createChannel()
Section titled “createChannel()”createChannel<M>(name?, options?): Channel<M>;Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
M extends MessageMap |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name? | string |
options? | ChannelOptions<M> |
Returns
Section titled “Returns”Channel<M>
Inherited from
Section titled “Inherited from”createLeader()
Section titled “createLeader()”createLeader(name?, options?): Leader;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name? | string |
options? | LeaderOptions |
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”createPresence()
Section titled “createPresence()”createPresence(name?, options?): Presence;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name? | string |
options? | PresenceOptions |
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”createSharedStore()
Section titled “createSharedStore()”createSharedStore<S>( name, initial,options?): SharedStore<S>;Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
S extends Record<string, unknown> |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name | string | undefined |
initial | S |
options? | SharedStoreOptions<S> |
Returns
Section titled “Returns”SharedStore<S>
Inherited from
Section titled “Inherited from”defineChannel()
Section titled “defineChannel()”defineChannel<M>(name?, options?): ChannelHooks<M>;Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
M extends MessageMap |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name? | string |
options? | ChannelOptions<M> |
Returns
Section titled “Returns”ChannelHooks<M>
defineStore()
Section titled “defineStore()”defineStore<S>(name, options?): StoreHooks<S>;Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
S extends Record<string, unknown> | Record<string, unknown> |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name | string |
options? | DefineStoreOptions |
Returns
Section titled “Returns”StoreHooks<S>
getSharedStore()
Section titled “getSharedStore()”getSharedStore(name?, scope?): AnyStore;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name? | string |
scope? | ShareScope |
Returns
Section titled “Returns”useClientId()
Section titled “useClientId()”useClientId(options?): string;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? | { name?: string; } |
options.name? | string |
Returns
Section titled “Returns”string
useHydrated()
Section titled “useHydrated()”useHydrated(options?): boolean;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? | UseSharedStateOptions |
Returns
Section titled “Returns”boolean
useIsLeader()
Section titled “useIsLeader()”useIsLeader(options?): boolean;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? | UseLeaderOptions |
Returns
Section titled “Returns”boolean
useLeader()
Section titled “useLeader()”useLeader(options?): LeaderSnapshot;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? | UseLeaderOptions |
Returns
Section titled “Returns”useLeaderEffect()
Section titled “useLeaderEffect()”useLeaderEffect(effect, options?): void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
effect | () => void | (() => void) |
options? | UseLeaderOptions |
Returns
Section titled “Returns”void
usePeers()
Section titled “usePeers()”usePeers(options?): readonly Peer[];Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? | UsePeersOptions |
Returns
Section titled “Returns”readonly Peer[]
usePresenceMetadata()
Section titled “usePresenceMetadata()”usePresenceMetadata(metadata, options?): void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
metadata | unknown |
options? | UsePeersOptions |
Returns
Section titled “Returns”void
useSharedState()
Section titled “useSharedState()”useSharedState<T>( key, initial, options?): [T, (next) => void];Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key | string |
initial | T |
options? | UseSharedStateOptions |
Returns
Section titled “Returns”[T, (next) => void]
useSharedStore()
Section titled “useSharedStore()”useSharedStore<S, T>(selector, options?): T;Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
S extends Record<string, unknown> |
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
selector | (state) => T |
options? | UseSharedSelectorOptions |
Returns
Section titled “Returns”T