React quickstart
Use this track when you want the 18ways runtime in React without the Next-specific adapter layer.
Install
npm install @18ways/reactBasic translation
import { useState } from 'react';
import {
LanguageSwitcher,
Ways,
T,
} from '@18ways/react';
export function App() {
const [locale, setLocale] = useState('fr-FR');
return (
<Ways
apiKey="YOUR_18WAYS_PUBLIC_API_KEY"
locale={locale}
baseLocale="en-GB"
context="app"
>
<LanguageSwitcher
currentLocale={locale}
onLocaleChange={setLocale}
/>
<Ways context="checkout.button">
<T>Pay now</T>
</Ways>
</Ways>
);
}From there, add useT(), nested contexts, and custom locale controls in the Usage page.
Next: React usage