Skip to content

@vowel.to/client v0.3.3-beta


@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

ParameterTypeDescription
optionsReactRouterAdaptersOptionsConfiguration options

Returns

ts
{
  navigationAdapter: NavigationAdapter;
  automationAdapter?: AutomationAdapter;
}

Navigation and automation adapters

NameTypeDefined in
navigationAdapterNavigationAdapterlib/vowel/adapters/helpers.ts:379
automationAdapter?AutomationAdapterlib/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
});