Skip to main content

Module: @evolv/react

Classes​

Interfaces​

Functions​

EvolvConsumer​

▸ EvolvConsumer(props, context?): null | ReactElement<any, any>

Parameters​

NameType
propsObject
props.children(client: ClientAdapter) => Element
context?any

Returns​

null | ReactElement<any, any>


EvolvProvider​

▸ EvolvProvider(props, context?): null | ReactElement<any, any>

Parameters​

NameType
propsEvolvProviderProps
context?any

Returns​

null | ReactElement<any, any>


debug​

▸ debug(namespace?): Debugger

Wrapper around Debug debug library.

Parameters​

NameType
namespace?string

Returns​

Debugger


useConfig​

▸ useConfig<T>(key, initialState): T

Hook that returns the value of the given configuration key.

Type parameters​

NameType
Tany

Parameters​

NameTypeDescription
keystringName of configuration value
initialStateTValue to use before Evolv initializes or in the event of an error

Returns​

T


useContextState​

▸ useContextState<T>(key): [T, Dispatch<T>]

Hook similar to React's useState() which returns a tuple containing a getter and setter.

Description

Hook sets a value on the Evolv context and will trigger a reaction that reevaluates variables based on the new context

Type parameters​

NameType
Tany

Parameters​

NameTypeDescription
keystringName of variable

Returns​

[T, Dispatch<T>]


useEvolv​

▸ useEvolv(): ClientAdapter

Returns the client adapter, which contains values such as the Evolv client and hydrated state.

Returns​

ClientAdapter


useIsKeyActive​

▸ useIsKeyActive(key): boolean

Hook that returns whether the given key is active or not.

Parameters​

NameTypeDescription
keystringName of variable

Returns​

boolean


useVariable​

▸ useVariable<T>(key, initialState): T

Hook that returns the variant allocated to the current user for the given variable.

Type parameters​

NameType
Tany

Parameters​

NameTypeDescription
keystringName of variable
initialStateTValue to use before Evolv initializes or in the event of an error

Returns​

T