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

content-react

new-react-router

Usage with an existing extension
Add React to an existing extension with the steps below.Installation
Install React runtime dependencies:react-refresh and @rspack/plugin-react-refresh. When one is missing, the build error names the exact version that matches the bundled toolchain. The install command in the error is phrased for the package manager that your project uses.
Configuration
Common React file patterns:- JavaScript:
*.jsx - TypeScript:
*.tsx
Development behavior
In development mode, Extension.js enables React refresh integration when it detects React.- Extension.js uses
react-refreshand@rspack/plugin-react-refreshfor refresh behavior. - If your project lacks optional refresh dependencies, Extension.js installs them and asks for a restart.
- Extension.js applies React aliases to 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.

