Vite and Create React App
Client-rendered React apps have one HTML file. Add the tag to its<head>, before your app’s script:
index.html
public/index.html.
- No hydration wait. A client-rendered app has no server HTML to hydrate, so leave out
data-await-hydration. - Content your app renders later: pagent applies a variant when the page loads and on every route change. If a test targets content that appears only after data has loaded, open the test’s preview link and check that the variant shows.
- Routing: React Router’s browser router is tracked automatically. With
HashRouter, send anavigatecommand on every route change, as described in Frameworks.
Remix and React Router (framework mode)
Server-rendered apps render the document inapp/root.tsx. Add the tag at the top of its <head>, with data-await-hydration="true":
app/root.tsx
Check it worked
- Deploy, then open your site in a private browser window.
- Back in pagent, click Check connection in the install step.
- Open a test’s preview link and check that the variant shows and stays after the page has finished loading.