ReactRouter
Optional plugin, for anyone using ReactRouter, providing automatically tracked Link and NavLink components.
Installation
yarn add @objectiv/plugin-react-router-tracked-components
or
npm install @objectiv/plugin-react-router-tracked-components
Drop-in replacements
Both TrackedLink
and TrackedNavLink
components are designed to be drop-in replacements of the original ones.
This allows, if desired, to swap components at import level:
import {
TrackedLink as Link,
TrackedNavLink as NavLink
} from "@objectiv/plugin-react-router-tracked-components";
Tracking automation
They basically perform two main tasks:
- They wrap the original implementation in a LinkContext.
- Automatically attach an onPress handler to track PressEvents.
Usage example
Check out this example application on codesandbox for a comprehensive list of all options and cases.