FeedbackJar
React frameworks ✓ 2 minutes setup Easy

FeedbackJar + React Router

FeedbackJar integrates with React Router v7 (framework mode) via a useEffect in your app/root.tsx. React Router v7 is the successor to Remix — the same setup applies if you migrated.

Get your Widget ID free → 7-day free trial · No credit card required

How to install FeedbackJar in React Router

1

Get your Widget ID

bash
# Sign up at app.feedbackjar.com
# Create a widget → copy your Widget ID
2

Load the SDK in app/root.tsx

tsx
// app/root.tsx
import { useEffect } from 'react';
import { Outlet } from 'react-router';

export default function App() {
  useEffect(() => {
    const script = document.createElement('script');
    script.src = 'https://cdn.feedbackjar.com/sdk.js';
    script.async = true;
    script.onload = () => window.fj.init(import.meta.env.VITE_FEEDBACKJAR_ID);
    document.body.appendChild(script);
    return () => { if (window.fj) window.fj.destroy(); };
  }, []);

  return <Outlet />;
}

Initialized once in the root — it persists across every route navigation.

3

Add your Widget ID to .env

bash
# .env
VITE_FEEDBACKJAR_ID=your_widget_id

React Router v7 uses Vite, so the VITE_ prefix exposes it to the client.

4

Identify users from the root loader (optional)

tsx
// app/root.tsx
import { useEffect } from 'react';
import { useLoaderData } from 'react-router';
import type { Route } from './+types/root';

export async function loader({ request }: Route.LoaderArgs) {
  const user = await getUser(request); // your auth helper
  return { user };
}

export default function App() {
  const { user } = useLoaderData<typeof loader>();

  useEffect(() => {
    if (user && window.fj) {
      window.fj.identify({ id: user.id, email: user.email });
    }
  }, [user]);

  // ...
}

What you get

  • Works with React Router v7 framework mode
  • SDK loaded once in app/root.tsx
  • Env var via Vite's import.meta.env
  • User identification from the root loader
  • Persists across every route navigation
  • TypeScript support

Add feedback to your React Router app today

Sign up free, grab your Widget ID, and have the feedback widget running in your React Router app in 2 minutes.

Start Free Trial 7-day free trial · No credit card required

Frequently Asked Questions

Looking for the full technical reference? Read the React Router docs →