Build a Chrome Extension with React: Step-by-Step Guide

Building a Chrome extension with React opens up a powerful combination of rapid development and robust user interfaces. While the Chrome Extension documentation often focuses on vanilla JavaScript, using React allows you to manage complex state and create reusable components with ease. This guide walks you through the entire process, from initializing the project to publishing your extension to the Chrome Web Store.

Setting Up the Project Structure

The first step is to establish a clear separation between your React application and the Chrome extension’s native files. You cannot simply run `create-react-app` and expect the manifest to work; you need to configure the build output to integrate with the extension’s background scripts and HTML popups. Create a root directory for your extension and initialize a new React project inside a folder named `src` or as a separate `client` directory.

Your root directory should contain the `manifest.json` file, which is the brain of your extension. Inside your React project, you will handle the view layer. This separation ensures that your development workflow remains focused on components while the extension logic remains contained in the root directory.

Beginner Tutorial: Build a Chrome Extension with React - YouTube

Configuring the Manifest File

The `manifest.json` file is the configuration blueprint for Chrome, defining permissions, entry points, and functionality. You must ensure that the `content_scripts` or `action` properties point to the correct HTML file generated by your React build process. For a standard popup extension, you will define an `action` key that loads the `index.html` from your React build folder.

Essential Manifest Keys

To avoid common pitfalls, your manifest requires specific keys to function correctly. The `manifest_version` is typically set to 3 for modern extensions, and the `content_security_policy` must be adjusted to allow inline scripts if your React app requires them during development. Below is a breakdown of the critical configuration options:

KeyDescriptionExample Value
manifest_versionAPI version for the extension3
action.default_popupHTML file for the popuppopup.html
content_scriptsScripts injected into web pages["js/content.js"]
background.service_workerPersistent or event background scriptbackground.js

Integrating React with the Build Process

By default, Create React App outputs static assets to a `build` folder. You need to modify your build configuration so that these assets are copied or linked into your extension’s root directory. You can achieve this by using a script in your `package.json` that runs `npm run build` followed by a file copy operation. Alternatively, tools like `react-scripts` can be ejected or overridden using a `paths` configuration to output directly into the extension folder.

Build Chrome Extensions with React JS | Devpost

Handling the `background.js` file requires a different approach. React does not manage service workers for extension background scripts, so you must create a separate JavaScript file in the root directory. You then import necessary logic into this file and ensure it is referenced correctly in the `manifest.json` under the `background.service_worker` field.

Managing State and Communication

A core challenge in combining React with Chrome extensions is managing the communication between the popup UI, content scripts, and the background service worker. React’s state management works within the popup component, but to interact with tabs or storage, you need to use `chrome.runtime` or `chrome.storage` APIs. Wrap these API calls in custom hooks to keep your React components clean and testable.

For passing data from content scripts to React, you can utilize `window.postMessage` for DOM-based communication or direct messaging APIs for background interactions. This ensures that your React components remain responsible for the view layer, while the extension logic handles browser interactions securely.

Optimizing for Performance and Security

Chrome extensions have strict content security policies, and React applications often include inline styles or eval-like functions that can trigger CSP errors. To mitigate this, avoid using `eval` in development tools and configure your React build to generate static assets that comply with `script-src 'self'`. Use external libraries cautiously and verify their compatibility with extension security models.

Performance is equally crucial. Since extensions load quickly to provide immediate feedback, you should code-split your React application using `React.lazy` and `Suspense`. Minimizing the initial bundle size ensures that your popup appears instantly, providing a seamless user experience that feels native rather than web-based.

Testing and Deployment

Before publishing, you must test the extension in the Chrome browser by navigating to `chrome://extensions` and enabling "Developer mode." Load the unpacked extension pointing to your root directory to verify that the React UI renders correctly and that the background scripts execute without errors. Pay close attention to the console logs for CSP violations or failed asset requests.

When you are ready to deploy, package your extension into a `.crx` file or publish it directly to the Chrome Web Store. Ensure that your `manifest.json` permissions are justified and minimal to comply with store review guidelines. A well-structured React-based extension not only functions smoothly but also provides a maintainable codebase for future updates and feature additions.

Reference

06.07.2024 ... In this post, I'll share my experience creating a Chrome extension, from using vanilla HTML, JS, and CSS to eventually migrating to React and using Vite for ...

Beginner Tutorial: Build a Chrome Extension with React - YouTube

Beginner Tutorial: Build a Chrome Extension with React - YouTube

Visual inspiration for your project.

Reference

19.08.2024 ... This brings up my productivity and helps you with building a chrome extension using react and web extension apis.

Build Chrome Extensions with React JS | Devpost

Build Chrome Extensions with React JS | Devpost

Visual inspiration for your project.

Reference

12.09.2025 ... Want to learn how to build a Chrome Extension with React and Tailwind CSS as a beginner? In this step-by-step tutorial, we'll create a ...

How to Build a Chrome Extension using React and Tailwindcss - DEV Community

How to Build a Chrome Extension using React and Tailwindcss - DEV Community

Visual inspiration for your project.

Reference

The Code · Go to chrome:://extensions in your browser · Ensure that Developer mode is on · Click Load unpacked extension... · Select the directory where the ...

Build your own Chrome Extension with React | IGNEK Blog

Build your own Chrome Extension with React | IGNEK Blog

Visual inspiration for your project.

Reference

25.04.2024 ... One approach is to compile your React code and bundle it into a single JavaScript file that you can then inject into the page using content ...

Build a Chrome extension with React | part 1/6 - YouTube

Build a Chrome extension with React | part 1/6 - YouTube

Visual inspiration for your project.

Reference

23.09.2024 ... In this guide, we'll build a Chrome extension using TypeScript, Webpack and Tailwind, and only then will bring React without CRA in much more ...

A Practical Guide to Building Chrome Extensions with React using Create ...

A Practical Guide to Building Chrome Extensions with React using Create ...

Visual inspiration for your project.

Reference

17.11.2023 ... I made DevPayHub for solo devs. Payments & users handled. https://devpayhub.com Learn how to create a chrome extension with React and ...

How to Build a Chrome Extension with React || Step-by-Step Tutorial ...

How to Build a Chrome Extension with React || Step-by-Step Tutorial ...

Visual inspiration for your project.

Reference

13.09.2024 ... Go to the Chrome Web Store Developer Dashboard, create a new item, and upload your extension package (the zip file of your project). Follow the ...

A Step-by-Step Guide to Creating a Chrome Extension with React

A Step-by-Step Guide to Creating a Chrome Extension with React

Visual inspiration for your project.

Reference

17.05.2025 ... This guide will show you how to set up a working project, complete with popup, sidePanel and context menu examples.

How to Create a Chrome Extension with React | HackerNoon

How to Create a Chrome Extension with React | HackerNoon

Visual inspiration for your project.

Reference

create-react-chrome-extension is a template for building Chrome and Firefox extensions using React and state-of-the-art settings.

A Practical Guide to Building Chrome Extensions with React using Create ...

A Practical Guide to Building Chrome Extensions with React using Create ...

Visual inspiration for your project.

Reference

Learn to set up Chrome extension scripts with manifest, background and content scripts, and webpack, then add definitively typed type libraries for Chrome, ...

How to build a chrome extension using React | Manifest version 3 - YouTube

How to build a chrome extension using React | Manifest version 3 - YouTube

Visual inspiration for your project.

Reference

Welcome to Chrome Extension development. Discover everything you need to start building and distributing your first Chrome Extension.

GitHub - rickwillcox/react-typescript-chrome-extension-template: A ...

GitHub - rickwillcox/react-typescript-chrome-extension-template: A ...

Visual inspiration for your project.

Reference

The best way to learn how to build Chrome extensions with React. Building Browser Extensions is the definitive guide for how to build and publish modern ...

How to Create a Chrome Extension with React | HackerNoon

How to Create a Chrome Extension with React | HackerNoon

Visual inspiration for your project.

Reference

23.04.2025 ... / discord In this video, we'll build a Chrome extension that elevates your Reddit experience with AI-powered filtering and comment interaction.

Creating a Chrome extension with React and TypeScript - LogRocket Blog

Creating a Chrome extension with React and TypeScript - LogRocket Blog

Visual inspiration for your project.

Reference

12.08.2021 ... Learn how Chrome extensions work and communicate, then see how to build one using the full power of React and TypeScript.

A Step-by-Step Guide to Creating a Chrome Extension with React

A Step-by-Step Guide to Creating a Chrome Extension with React

Visual inspiration for your project.

Reference

23.05.2024 ... How to Create a Chrome Extension Using React.js · Step 1: Set Up Your React App · Step 2: Create the Manifest File · Step 3: Create Background ...

Mastering Chrome Extension Development with React: A Comprehensive Guide

Mastering Chrome Extension Development with React: A Comprehensive Guide

Visual inspiration for your project.

Reference

05.06.2023 ... We've taken a good look at how to put together a single-page app (SPA) with React and package it as a Chrome Extension using Manifest V3.

How To Build A Chrome Extension Using React

How To Build A Chrome Extension Using React

Visual inspiration for your project.

Reference

25.07.2025 ... Want to build a real Chrome Extension using React + Vite — and actually understand how it works? ⚡ In this tutorial, I'll walk you through ...

How To Build A Chrome Extension Using React

How To Build A Chrome Extension Using React

Visual inspiration for your project.

Reference

23.01.2022 ... Let's start by creating the project. Run npm init vite@latest, choose your project name, select React, choose if you want it vanilla or with TypeScript.

How to Build a Chrome Extension with React - YouTube

How to Build a Chrome Extension with React - YouTube

Visual inspiration for your project.

Reference

The easiest way to debug websites built with React is to install the React Developer Tools browser extension. ... build of React DevTools by following the Safari ...

Build Chrome Extension with React JS - M2K Developments

Build Chrome Extension with React JS - M2K Developments

Visual inspiration for your project.