@algolia/predict-react
TypeScript icon, indicating that this package has built-in type declarations

1.7.1 • Public • Published

Predict for React

🚧 This version is not yet production-ready.

Predict for React lets you build personalized user experiences with Algolia Predict.

Installation

Predict for React is available on the npm registry and works alongside the Predict API client (@algolia/predict) to retrieve the user profile.

yarn add @algolia/predict@alpha @algolia/predict-react
# or
npm install @algolia/predict@alpha @algolia/predict-react

Usage

import { Predict, usePredict } from '@algolia/predict-react';

function App({ userProfile }) {
  return (
    <Predict userProfile={userProfile}>
      <Page />
    </Predict>
  );
}

function Page() {
  const {
    userProfile,
    affinities,
    funnelStage,
    orderValue,
    cartAbandonment,
    segments,
    properties,
    zones,
  } = usePredict();

  return <>{/* Your JSX */}</>;
}

Continue reading our Getting Started guide.

Documentation

The documentation offers a few ways to learn about Predict for React:

  • Getting Started. Discover the library: fetch the user profile (on the server and on the client), personalize content with zones, inspect the user profile.
  • API Reference. Learn about the components and Hooks provided by the library.
  • Guides. Read common use cases and learn how to implement them.
  • Playbook. Find inspiration for your personalization use cases, and copy the templates.

You can find more on the documentation.

Inspect and debug

Personalized experiences are hard to debug because the content depends on who is browsing the app. The Predict Tools web extension lets you inspect user profiles to debug personalized apps.

Predict Tools web extension open on the Predict Storefront

The Predict Tools web extension is your development companion for Predict. It presents data to better analyze and debug your Predict experience.

Read more about the Predict Tools web extension.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @algolia/predict-react

Weekly Downloads

83

Version

1.7.1

License

MIT

Unpacked Size

416 kB

Total Files

38

Last publish

Collaborators

  • wwalser
  • jkaho
  • mprevell97
  • louishousiaux
  • antoine.gilles
  • eventexperiences_algolia
  • jsok_algolia
  • bhinchley-algolia
  • hugowit
  • alg-admin
  • aymeric.giraudet
  • gavinwade12
  • bhcastle
  • rishi_algolia
  • jasonberry
  • scyganek-algolia
  • drodriguln
  • abodelot
  • leviwhalen
  • sfaiqh
  • valentindotxyz
  • fluf
  • instantsearch-bot
  • taylorcjohnson_algolia
  • pjankowski5312
  • raed-algolia
  • dylantientcheu
  • catalgolia
  • morgan-algolia
  • algabet
  • andy_ds
  • bengreenbank
  • alg-bgastinne
  • daltondickalgolia
  • jcohonner-algolia
  • robertmogos
  • mariaalungu
  • emmanuel.fortin
  • ejaldorau
  • dhaya.b
  • lukyvj
  • marielaure
  • haroenv
  • rayrutjes
  • jerska
  • ronanlevesque
  • samouss
  • therealwebby
  • francoischalifour
  • jonmontane
  • tkrugg
  • seafoox
  • sylvainh
  • clemfromspace
  • lorrissaintgenez
  • broujo
  • e-krebs
  • kombucha
  • sylvain
  • crawler-team
  • amcdaid106
  • devinalgolia
  • jvenezia
  • otomatik
  • sophiem03
  • sarahdayan
  • dcoates
  • maximehuang
  • guitek
  • matthewbond
  • cyril.descossy
  • tatsuro
  • danajeremy
  • mathougui
  • xavdh
  • agdavid
  • rasemotte
  • plnech
  • shortcuts
  • praagyajoshi
  • loicsay
  • svensoldin
  • alphonseb
  • leodau
  • fabienmotte
  • sarahfranc
  • millotp