@foresightjs/react
v1.0.0
Published
React bindings for ForesightJS - hooks and helpers to register elements with the ForesightManager from React components.
Maintainers
Readme
@foresightjs/react
Official React bindings for ForesightJS, a lightweight library that predicts user intent (mouse trajectory, keyboard navigation, scroll, touch) to trigger callbacks like prefetching before the user interacts.
- Docs: foresightjs.com/docs/react/installation
- Core library:
js.foresight - Playground: foresightjs.com
Installation
pnpm add @foresightjs/react js.foresight
# or
npm install @foresightjs/react js.foresightRequires React 18+
What's included
useForesight-> register a single element and get its live state plus a callback ref to bind itForesight-> component form of useForesight with a render prop, for dynamic lists or wherever the hook is awkwarduseForesightEvent-> subscribe to a ForesightManager event for the lifetime of the component
For usage and examples, see the React documentation, including guides for Next.js and React Router.
Contributing
Please see the contributing guidelines.
