React SDK
<NinetailedProvider>
The <NinetailedProvider> provides a Ninetailed instance to the application. It can accept all of the same instantiation options as a Ninetailed instance to create a new one or accept an existing Ninetailed instance.
The provided Ninetailed instance can be retreived with the useNinetailed hook.
Types
Hooks
useExperience
Returns the loading state of an experience and once loaded, the all relevant metadata of the experience including the assigned variant and variant index. This hook powers the React <Experience> component exported by the SDKs.
This hook is useful when you need imperative access to the metadata an assigned experience, often in circumstances where you are not intending to render out CMS-sourced content variations. For example, you might be using a feature-flag style experiment where you have no need for the <Experience> component, but your application still needs to change behavior and/or send tracking calls based on the assigned variantIndex.
useNinetailed
Retrieves the Ninetailed instance from the nearest <NinetailedProvider> and all of its instance methods and properties as in the Ninetailed Instance documentation.
useProfile
Retrieves the current profile state from the nearest <NinetailedProvider>.
Components
<Experience>
The <Experience> component is the primary way to render personalized content. It wraps a component and automatically selects the correct variant based on the visitor’s audience membership.
Props:
All other props are spread onto the rendered component as the baseline content.
<MergeTag>
The <MergeTag> component renders visitor-specific profile data inline. It resolves a dot-notation path against the visitor’s profile and renders the value, falling back to a default if unavailable.
Props:
Merge tags can also be embedded as nt_mergetag entries in Contentful rich text fields. See the Experience SDK documentation for rich text rendering patterns.