Module: @evolv/react
Classes
Interfaces
- Debugger
- EvolvClientOptions
- EvolvProviderProps
- LocalContext
- ParticipantsApiContext
- RemoteContext
- WebRemoteContext
Functions
EvolvConsumer
▸ EvolvConsumer(props, context?): null | ReactElement<any, any>
Parameters
| Name | Type |
|---|---|
props | Object |
props.children | (client: ClientAdapter) => Element |
context? | any |
Returns
null | ReactElement<any, any>
EvolvProvider
▸ EvolvProvider(props, context?): null | ReactElement<any, any>
Parameters
| Name | Type |
|---|---|
props | EvolvProviderProps |
context? | any |
Returns
null | ReactElement<any, any>
debug
▸ debug(namespace?): Debugger
Wrapper around Debug debug library.
Parameters
| Name | Type |
|---|---|
namespace? | string |
Returns
useConfig
▸ useConfig<T>(key, initialState): T
Hook that returns the value of the given configuration key.
Type parameters
| Name | Type |
|---|---|
T | any |
Parameters
| Name | Type | Description |
|---|---|---|
key | string | Name of configuration value |
initialState | T | Value 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
| Name | Type |
|---|---|
T | any |
Parameters
| Name | Type | Description |
|---|---|---|
key | string | Name 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
useIsKeyActive
▸ useIsKeyActive(key): boolean
Hook that returns whether the given key is active or not.
Parameters
| Name | Type | Description |
|---|---|---|
key | string | Name 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
| Name | Type |
|---|---|
T | any |
Parameters
| Name | Type | Description |
|---|---|---|
key | string | Name of variable |
initialState | T | Value to use before Evolv initializes or in the event of an error |
Returns
T