Skip to main content

Provider for React

info

Any components that will make use of the Evolv AI platform must be wrapped by <EvolvProvider />.

Configure client options

The <EvolvProvider /> component is responsible for instantiating an instance of the Evolv client, which will retrieve the configuration and variables for your projects. The only required option is environment.

tip

For existing customers, the environment ID can be obtained from the Environments page in the Evolv AI Manager.

src/index.tsx
import { EvolvClientOptions } from '@evolv/react';

const options: EvolvClientOptions = {
environment: '[environmentId]'
};

See also

Add <EvolvProvider /> to your application or page

info

For usage in NextJS applications, see here.

Props

NameTypeRequiredDescription
optionsobjecttrueOptions passed to EvolvClient. See list of options
uidstringtrueUnique identifier of the current user. See User IDs
hydratedStateobjectfalseValue to hydrate as the user's allocation variant. This is primarily used for server-side applications
remoteContextobjectfalseAdditional values added to the context
localContextobjectfalseAdditional values added to the context that will not be transmitted to Evolv
src/index.tsx
import { EvolvProvider } from '@evolv/react';
import React, { FC } from 'react';

const App: FC = () => {
return (
<EvolvProvider
options={options}
uid={uid}
remoteContext={remoteContext}
>
<h1>My React app</h1>
</EvolvProvider>
);
}

export default App;

See also