InvergeDocs
JavaScriptAPI reference

React

React in the JavaScript SDK.

import { NexusProvider, useNexus } from '@inverge/nexus/react'
SymbolKindSummary
NexusProviderPropsinterface
NexusProvider()functionProvides a Nexus instance to the tree.
useNexus()functionThe Nexus instance from context (falls back to the global singleton).
useTrackEvent()functionTrack an event with a stable callback.
useFlag()functionWhether a feature flag is enabled (call nexus.flags.load() first).
useRemoteConfig()functionSubscribe to Remote Config; re-renders when the config changes.
useRemoteConfigValue()functionA single Remote Config value, re-rendered on change.

NexusProviderProps

interface @inverge/nexus/react

client

property
client?: Nexus

Provide either a ready instance, or a config to init one.

config

property
config?: NexusConfig

children

property
children: React.ReactNode

Functions

NexusProvider()

function
NexusProvider({ client, config, children }: NexusProviderProps): React.ReactElement

Provides a Nexus instance to the tree. Pass a config to auto-init, or a client you created yourself.

Parameters

Prop

Type

Returns React.ReactElement

View source

useNexus()

function
useNexus(): Nexus

The Nexus instance from context (falls back to the global singleton).

Returns Nexus

View source

useTrackEvent()

function
useTrackEvent(): (name: string, properties?: Record<string, unknown>) => void

Track an event with a stable callback.

Returns (name: string, properties?: Record<string, unknown>) => void

View source

useFlag()

function
useFlag(key: string): boolean

Whether a feature flag is enabled (call nexus.flags.load() first).

Parameters

Prop

Type

Returns boolean

View source

useRemoteConfig()

function
useRemoteConfig(): Nexus['remoteConfig']

Subscribe to Remote Config; re-renders when the config changes. Returns the service so you can call getString/getBool/…

Returns Nexus['remoteConfig']

View source

useRemoteConfigValue()

function
useRemoteConfigValue<T = unknown>(key: string, fallback?: T): T

A single Remote Config value, re-rendered on change.

Parameters

Prop

Type

Returns T

View source

On this page