@inttegro/cogni-react-router keeps React Router’s to-based link API and adds calibrated route
prediction. The smallest integration is a component replacement.
This guide follows the
0.1 API. The adapter supports React Router 7.9 through 8.x. Confirm the
latest published version and migration notes before installing a newer 0.x release.Replace Link
PredictiveLink preserves ordinary React Router link props and event handlers. Sustained hover
waits 120 ms by default. Focus, touch, primary pointer-down, and ordinary click intent start
immediately. Modified, downloaded, external, full-document, new-context, or prevented navigation
does not count as reuse.
Router modes
In Framework Mode, Cogni activatesPrefetchPageLinks only after the prediction passes admission.
It waits for the emitted data and module resources to settle before recording the route as loaded.
React Router’s independent link prefetch is set to none, so the same intent does not issue work
twice.
Data and Declarative Mode do not expose Framework Mode’s universal route-prefetch contract. Supply
the cache operation your application already uses:
Candidate policy
UsepredictionKey, policy, cost, priority, and estimatedBytes when the default route
identity is not enough. Cogni starts with its conservative probability and 30 second reuse horizon,
then learns from actual reuse and waste. Override probability or horizonMs when the application
has stronger evidence.
See React for provider ownership and Candidates and reuse for
quality accounting.