@vowel.to/client / index / createReactRouterAdapters
Function: createReactRouterAdapters()
ts
function createReactRouterAdapters(options): {
navigationAdapter: NavigationAdapter;
automationAdapter?: AutomationAdapter;
};Defined in: lib/vowel/adapters/helpers.ts:378
Create React Router adapters
Specialized adapters for React Router with proper location tracking.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | ReactRouterAdaptersOptions | Configuration options |
Returns
ts
{
navigationAdapter: NavigationAdapter;
automationAdapter?: AutomationAdapter;
}Navigation and automation adapters
| Name | Type | Defined in |
|---|---|---|
navigationAdapter | NavigationAdapter | lib/vowel/adapters/helpers.ts:379 |
automationAdapter? | AutomationAdapter | lib/vowel/adapters/helpers.ts:380 |
Example
ts
import { createReactRouterAdapters } from '@vowel.to/client/adapters/helpers';
import { Vowel } from '@vowel.to/client';
import { useNavigate, useLocation } from 'react-router-dom';
const navigate = useNavigate();
const location = useLocation();
const { navigationAdapter, automationAdapter } = createReactRouterAdapters({
navigate,
location,
routes: [
{ path: '/', description: 'Home' },
{ path: '/about', description: 'About' }
],
enableAutomation: true
});
const vowel = new Vowel({
appId: 'app-id',
navigationAdapter,
automationAdapter
});