RevDock | Docs
Installation Guides

React Router

Add RevDock to your React Router SPA in under 2 minutes.

Works with React Router v6 and Vite, Create React App, or any React setup.

Setup

Add the script dynamically in your root component:

import { useEffect } from 'react';

function App() {
  useEffect(() => {
    const script = document.createElement('script');
    script.src = 'https://getrevdock.com/scripts/revdock.js';
    script.defer = true;
    script.dataset.websiteId = 'YOUR_WEBSITE_ID';
    document.head.appendChild(script);

    return () => script.remove();
  }, []);

  return (
    // Your routes
  );
}

Add the script directly to index.html (or public/index.html):

<!DOCTYPE html>
<html lang="en">
  <head>
    <script
      defer
      src="https://getrevdock.com/scripts/revdock.js"
      data-website-id="YOUR_WEBSITE_ID"
    ></script>
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>

The index.html method is simpler and recommended for most projects.

Using environment variables

With Vite, add to .env:

VITE_REVDOCK_ID=your_website_id

Then use import.meta.env.VITE_REVDOCK_ID in your code.

Verify it's working

  1. Deploy your app
  2. Visit your live site
  3. Check the RevDock dashboard — widgets should appear within minutes

On this page