Skip to content
LogoLogo

React

@picked/react lets the Picked client render React components, and gives hooks and components to read the client from React.

Peer dependencyVersion
react, react-dom^18.3.0 or ^19.0.0
@picked/clientThe version of your Picked SDK
effector^23.4.4

Entry points

ImportExports
@picked/reactadaptReactComponent, isValidAdaptedComponent, PickedProvider, ExperienceSlot, HtmlRender
@picked/react/plugins/frameworkreactFrameworkPlugin
@picked/react/hooksusePicked, useExperience, useStep, useStepContent, useStepLayoutContent, useSetStepContext, useFeature, useFeatureResult, useFeatureEnabled, useAction, useActionResult, useContent, useReference, useReferences, useStoreGlobal, useSessionStorage, useLocalStorage, the field hooks, and the context providers
@picked/react/routerStepRouter, Step
@picked/react/formuseForm
@picked/react/serverrenderer, which renders a React component to HTML on the server

Framework plugin

reactFrameworkPlugin registers React as a framework of the client. The client then renders each React component in a shadow root.

import { createClient } from 'picked'
import { reactFrameworkPlugin } from '@picked/react/plugins/framework'
 
const client = createClient({
  projectId: 'your-project-id',
  plugins: [reactFrameworkPlugin({ components: {} })],
})
OptionTypeDefaultDescription
components{ experience?: { component, style? } }requiredexperience renders each experience that has no component of its own.
stylesheetsstring[]noneThe URLs of stylesheets to add to each shadow root.
cssstring[]noneCSS text to add to each shadow root.

Components

adaptReactComponent(component) makes a React component that the client can render. It takes a component, a dynamic import, or a lazy loader. See How to register a component.