# Use Pollenate with React and Next.js > Render the typed React widget, attach context and callbacks, and choose when it remounts. Canonical URL: https://pollenate.dev/docs/widgets/react/ The package is **`@pollenate/react`** and its component is **`PollenateWidget`**. It renders the collector directly; you do not need to add the standalone widget script for the same instance. ```bash npm install @pollenate/react ``` ## Add the component ```tsx import { PollenateWidget } from '@pollenate/react'; export function Helpfulness() { return ( { console.log('Saved feedback ID:', event.detail.id); }} /> ); } ``` `apiKey` and `inboxKey` are required. The key must be an organization collection key. The `onSubmit` callback receives a CustomEvent with the saved feedback in `event.detail`; `onImpression` receives the impression event. ## Next.js App Router Put the widget in a Client Component: ```tsx 'use client'; import { PollenateWidget } from '@pollenate/react'; export function ProductFeedback() { const apiKey = process.env.NEXT_PUBLIC_POLLENATE_COLLECT_KEY; const inboxKey = process.env.NEXT_PUBLIC_POLLENATE_INBOX_KEY; if (!apiKey || !inboxKey) return null; return ; } ``` Variables prefixed `NEXT_PUBLIC_` are public browser configuration. Only place a collect-only organization key there. Keep privileged credentials on your server. ## Useful props | Props | Purpose | | --- | --- | | `type`, `prompt` | Choose the scale and question | | `inline`, `position` | Render in the component location or choose a floating position | | `theme` | `light`, `dark` or system-following `auto` | | `context` | Attach your own product, route or release context | | `trackImpressions` | Enable/disable impression tracking; default is true | | `stripQueryParams` | Omit page query parameters from tracking | | `primaryColor`, `bgColor`, `textColor`, `borderColor` | Override appearance | | `buttonText`, `successMessage`, `commentPlaceholder` | Customize messages | | `onSubmit`, `onImpression` | React callbacks for widget events | For inline use, place the component where it should render and set `inline`. The compatibility `container` prop also enables inline mode; the React component renders in its React tree rather than moving itself into a DOM element selected by that string. ## Route changes and verification The widget tracks an impression once per mounted instance. If each route needs a fresh prompt and impression, remount deliberately with a React `key`, such as the current route. Keep a stable key when you want the same instance to survive navigation; avoid keying it to every render. Use real route context from your app, submit a test event, and verify the destination inbox. If the widget fails, check the same key, scope, brand and [CSP requirements](/docs/troubleshooting/csp/) as the standalone script. For a completely different interface, use [custom UI](/docs/widgets/custom-ui/).