Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

react-scan

> 前端框架
Open source

Scan and fix React performance issues

21.7K stars0 likes2 views
WebsiteGitHub

About

Scan and fix React performance issues

React Scan

You can still use React Scan, but we recommend React Doctor

React Doctor brings React Scan’s performance focus to coding agents, with static checks for architecture, security, accessibility, and more. Try React Doctor →

React Scan automatically detects performance issues in your React app.

  • Requires no code changes -- just drop it in
  • Highlights exactly the components you need to optimize
  • Always accessible through a toolbar on page

Quick Start

bash
npx -y react-scan@latest init

Try out a demo! →

Install

The init command will automatically detect your framework, install react-scan via npm, and set up your project.

bash
npx -y react-scan@latest init

Manual Installation

Install the package:

bash
npm install -D react-scan

Then add the script tag to your app. Pick the guide for your framework:

Script Tag

Paste this before any scripts in your index.html:

xml

<script
  crossOrigin="anonymous"
  src="//unpkg.com/react-scan/dist/auto.global.js"
></script>

Next.js (App Router)

Add this inside of your app/layout.tsx:

typescript
import Script from "next/script";

export default function RootLayout({ children }) {
  return (
    <html>
      <head>
        <Script
          src="//unpkg.com/react-scan/dist/auto.global.js"
          crossOrigin="anonymous"
          strategy="beforeInteractive"
        />
      </head>
      <body>{children}</body>
    </html>
  );
}

Next.js (Pages Router)

Add this into your pages/_document.tsx:

typescript
import { Html, Head, Main, NextScript } from "next/document";
import Script from "next/script";

export default function Document() {
  return (
    <Html lang="en">
      <Head>
        <Script
          src="//unpkg.com/react-scan/dist/auto.global.js"
          crossOrigin="anonymous"
          strategy="beforeInteractive"
        />
      </Head>
      <body>
        <Main />
        <NextScript />
      </body>
    </Html>
  );
}

Vite

Example index.html with React Scan enabled:

xml
<!doctype html>
<html lang="en">
  <head>
    <script
      crossOrigin="anonymous"
      src="//unpkg.com/react-scan/dist/auto.global.js"
    ></script>
  </head>
  <body>
    

    <script type="module" src="/src/main.tsx"></script>
  </body>
</html>

Remix

Add this inside your app/root.tsx:

typescript
import { Links, Meta, Outlet, Scripts } from "@remix-run/react";

export default function App() {
  return (
    <html>
      <head>
        <Meta />
        <script
          crossOrigin="anonymous"
          src="//unpkg.com/react-scan/dist/auto.global.js"
        />
        <Links />
      </head>
      <body>
        <Outlet />
        <Scripts />
      </body>
    </html>
  );
}

Browser Extension

Install the extension by following the guide here.

API Reference

Options
…
  • scan(options: Options): Imperative API to start scanning
  • useScan(options: Options): Hook API to start scanning
  • setOptions(options: Options): void: Set options at runtime
  • getOptions(): Get the current options
  • onRender(Component, onRender: (fiber: Fiber, render: Render) => void): Hook into a specific component's renders

Why React Scan?

React can be tricky to optimize.

The issue is that component props are compared by reference, not value. This is intentional -- rendering can be cheap to run.

However, this makes it easy to accidentally cause unnecessary renders, making the app slow. Even production apps with hundreds of engineers can't fully optimize their apps (see GitHub, Twitter, and Instagram).

javascript
<ExpensiveComponent onClick={() => alert("hi")} style={{ color: "purple" }} />

React Scan helps you identify these issues by automatically detecting and highlighting renders that cause performance issues.

Resources & Contributing

Want to try it out? Check the demo.

Looking to contribute? Check the Contributing Guide.

Want to talk to the community? Join our Discord.

Find a bug? Head to our issue tracker.

→ Start contributing on GitHub

Acknowledgments

  • React Devtools for the initial idea of highlighting renders
  • Million Lint for scanning and linting approaches
  • Why Did You Render? for the concept of detecting unnecessary renders

License

React Scan is MIT-licensed open-source software by Aiden Bai, Million Software, Inc., and contributors.

Issues· 77 open

View all issuesOpen on GitHub
  • #472

    Unconditional version-check fetch to react-grab.com on start() with no opt-out

    Updated Aug 26, 2026
  • #471

    Published package ships unpinned "latest" runtime deps (react-doctor, react-grab)

    Updated Aug 26, 2026
  • #464

    Home page (react-scan.com) has no visual gap between "React Scan" and secondary text just below the logo.

    Updated Aug 25, 2026
  • #460

    Bug: useScan() ignores `enabled: false` and always starts scanning

    Updated Aug 25, 2026
  • #456

    BROWSER_EXTENSION_GUIDE.md 404 — referenced from README

    Updated Aug 25, 2026
  • #271

    [Feature Request] MCP Server

    Updated Aug 4, 2026
  • #468

    react-scan 0.5.x floats react-grab and react-doctor on the "latest" dist-tag, making resolutions non-reproducible

    Updated Jul 25, 2026
  • #467

    react-scan 0.5.6+ fails on Rspack: named export from react-grab/package.json

    Updated Jul 25, 2026
  • #463

    0.5.7 overlay toggle switch (and other translate/rotate utilities) render broken: Tailwind v4 @property rules unregistered inside shadow DOM

    Updated Jul 1, 2026
  • #234

    How/where is getReport() supposed to be used?

    Updated Jun 24, 2026

> Tags

TypeScriptjavascriptreactreact-domreact-scan

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架