React
Build browser extension UIs with React using the default Extension.js pipeline.
Extension.js detects React from your project dependencies and configures JSX/TSX transforms, React aliases, and development refresh integration automatically.
When React is a good fit
- You are building rich UI surfaces like popup, options, sidebar, or new tab.
- You want component reuse across extension pages and content-script UI mounts.
- You already use React in web projects and want the same development model in extensions.
Template examples
new-react

Build a React new-tab experience with a ready-to-run project structure.
Repository: extension-js/examples/new-react
content-react

Inject React UI into existing pages with a content-script-first setup.
Repository: extension-js/examples/content-react
Usage with an existing extension
If you want to add React to an existing extension:
Installation
Install React runtime dependencies:
If you use TypeScript, also install React type packages:
Configuration
Common React file patterns:
- JavaScript:
*.jsx - TypeScript:
*.tsx
Development behavior
In development mode, Extension.js enables React refresh integration when React is detected.
react-refreshand@rspack/plugin-react-refreshare used for refresh behavior.- If optional refresh dependencies are missing, Extension.js installs them and asks for a restart.
- React aliases are applied to help keep a single React/runtime instance in your bundle.
Usage examples
In a new tab extension
Example page entry:
In a content_script file
For content scripts, render React into an injected root element:
Next steps
- Learn more about TypeScript support.
- Explore how Extension.js handles Sass modules.
