Module: @evolv/nextjs
Classes
Interfaces
- Debugger
- EvolvClientOptions
- EvolvOptions
- EvolvProviderProps
- EvolvServerSideProps
- LocalContext
- ParticipantsApiContext
- RemoteContext
- WebRemoteContext
Functions
EvolvCoexistenceMode
▸ EvolvCoexistenceMode(props
, context?
): null
| ReactElement
<any
, any
>
Component that activates coexistence mode in which the Evolv Asset Manager and the Evolv NextJS SDK can coexist.
Parameters
Name | Type |
---|---|
props | Object |
context? | any |
Returns
null
| ReactElement
<any
, any
>
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
getEvolvServerSideProps
▸ getEvolvServerSideProps(options
): PropsFactory
<Result
>
Server-side loader function that builds out the necessary data needed to hydrate page during rendering. The
return value of this function will become the value of props
that is passed to the page component.
Description
If a page does not need to export its own getServerSideProps()
function, use the shorter form shown in the first example.
If a page does need to export its own getServerSideProps()
function, use the longer form inside the page's
getServerSideProps()
function to merge together page props and Evolv props.
Example
export const getServerSideProps = getEvolvServerSideProps(options);
Example
export function getServerSideProps(ctx) {
const pageProps = {};
const { props: evolvProps } = await getEvolvServerSideProps(options, ctx);
return {
props: {
...pageProps
...evolvProps
}
};
}
Parameters
Name | Type |
---|---|
options | EvolvOptions |
Returns
PropsFactory
<Result
>
▸ getEvolvServerSideProps(options
, ctx
): Promise
<Result
>
Parameters
Name | Type |
---|---|
options | EvolvOptions |
ctx | GetServerSidePropsContext <ParsedUrlQuery , PreviewData > |
Returns
Promise
<Result
>
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