Rxova
Skip to content

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.

readonly name: string;

The prefix every name from this namespace carries.

Namespace.name

busName(name?): string;

What a bare name becomes here. Exposed so devtools, observeBus and tests can name the same bus.

ParameterType
name?string

string

Namespace.busName


createChannel<M>(name?, options?): Channel<M>;
Type Parameter
M extends MessageMap
ParameterType
name?string
options?ChannelOptions<M>

Channel<M>

Namespace.createChannel


createLeader(name?, options?): Leader;
ParameterType
name?string
options?LeaderOptions

Leader

Namespace.createLeader


createPresence(name?, options?): Presence;
ParameterType
name?string
options?PresenceOptions

Presence

Namespace.createPresence


createSharedStore<S>(
name,
initial,
options?): SharedStore<S>;
Type Parameter
S extends Record<string, unknown>
ParameterType
namestring | undefined
initialS
options?SharedStoreOptions<S>

SharedStore<S>

Namespace.createSharedStore


defineChannel<M>(name?, options?): ChannelHooks<M>;
Type Parameter
M extends MessageMap
ParameterType
name?string
options?ChannelOptions<M>

ChannelHooks<M>


defineStore<S>(name, options?): StoreHooks<S>;
Type ParameterDefault type
S extends Record<string, unknown>Record<string, unknown>
ParameterType
namestring
options?DefineStoreOptions

StoreHooks<S>


getSharedStore(name?, scope?): AnyStore;
ParameterType
name?string
scope?ShareScope

AnyStore


useClientId(options?): string;
ParameterType
options?{ name?: string; }
options.name?string

string


useHydrated(options?): boolean;
ParameterType
options?UseSharedStateOptions

boolean


useIsLeader(options?): boolean;
ParameterType
options?UseLeaderOptions

boolean


useLeader(options?): LeaderSnapshot;
ParameterType
options?UseLeaderOptions

LeaderSnapshot


useLeaderEffect(effect, options?): void;
ParameterType
effect() => void | (() => void)
options?UseLeaderOptions

void


usePeers(options?): readonly Peer[];
ParameterType
options?UsePeersOptions

readonly Peer[]


usePresenceMetadata(metadata, options?): void;
ParameterType
metadataunknown
options?UsePeersOptions

void


useSharedState<T>(
key,
initial,
options?): [T, (next) => void];
Type Parameter
T
ParameterType
keystring
initialT
options?UseSharedStateOptions

[T, (next) => void]


useSharedStore<S, T>(selector, options?): T;
Type Parameter
S extends Record<string, unknown>
T
ParameterType
selector(state) => T
options?UseSharedSelectorOptions

T