Skip to main content
Version: 4.x

Installation

npm version npm downloads

@foresightjs/react is the official React package for ForesightJS. It gives you useForesight, the Foresight component and useForesightEvent so you can register elements and read their prediction state straight from a component.

npm install @foresightjs/react js.foresight
# or
pnpm add @foresightjs/react js.foresight
# or
yarn add @foresightjs/react js.foresight
import { useForesight, ForesightManager } from "@foresightjs/react"

Configuring the manager​

You don't have to configure anything. The manager auto-initializes with sensible defaults the first time you register an element.

If you do want to tweak global behaviour, call ForesightManager.initialize() once at your app entry point. See Initialize the Manager and Global Settings.

Devtools​

The visual Development Tools live in their own package (js.foresight-devtools) and work the same regardless of framework.