npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@react-perfscope/react

v0.7.1

Published

React render collector for react-perfscope.

Readme

@react-perfscope/react

React 18+ render collector for react-perfscope. Observes React commits and emits one RenderSignal per changed component, plugging into @react-perfscope/core.

Install

npm install @react-perfscope/react @react-perfscope/core

Usage

import { createRecorder } from '@react-perfscope/core'
import { createRenderCollector } from '@react-perfscope/react'

const recorder = createRecorder()
recorder.use(createRenderCollector())

recorder.start()
// ... interact with the app ...
const result = recorder.stop()

console.log(result.signals.filter((s) => s.kind === 'render'))

Load order (important)

react-dom reads the DevTools global hook once at module-evaluation time. Import @react-perfscope/react (or call createRenderCollector()) before any code that imports react-dom/client, otherwise the collector never receives commits:

// At the very top of your entry file
import { createRecorder } from '@react-perfscope/core'
import { createRenderCollector } from '@react-perfscope/react'

const recorder = createRecorder()
recorder.use(createRenderCollector())

// Now import React-DOM-touching code
import './app'

The react-perfscope meta package and the build plugins handle this ordering automatically.

API

  • createRenderCollector() — Collector factory. Emits RenderSignal per non-host fiber on each React commit.
  • resolveComponentFromElement(el) — Given a DOM element, return the nearest React component name (or null).
  • installDevToolsHook(listener) — Low-level DevTools hook installer. Returns an unsubscribe function.
  • fiberComponentName(fiber) — Resolve a fiber to its component name.
  • walkChangedFibers(root, visit, { stopAt }) — Depth-first traversal of a fiber subtree with an upper bound.

한국어

react-perfscope용 React 18+ render collector. React 커밋을 감지해서 변경된 컴포넌트마다 RenderSignal 하나를 내보내고, @react-perfscope/core에 연결된다.

설치

npm install @react-perfscope/react @react-perfscope/core

사용법

import { createRecorder } from '@react-perfscope/core'
import { createRenderCollector } from '@react-perfscope/react'

const recorder = createRecorder()
recorder.use(createRenderCollector())

recorder.start()
// ... 앱과 상호작용 ...
const result = recorder.stop()

console.log(result.signals.filter((s) => s.kind === 'render'))

로드 순서 (중요)

react-dom은 모듈 평가 시점에 DevTools 글로벌 훅을 딱 한 번 읽는다. 그래서 @react-perfscope/react를 import하거나 createRenderCollector()를 호출하는 건 react-dom/client를 import하는 어떤 코드보다도 먼저 와야 한다. 안 그러면 collector가 커밋을 영원히 못 받는다:

// entry 파일 맨 위에
import { createRecorder } from '@react-perfscope/core'
import { createRenderCollector } from '@react-perfscope/react'

const recorder = createRecorder()
recorder.use(createRenderCollector())

// 이제 React-DOM을 건드리는 코드를 import
import './app'

react-perfscope 메타 패키지나 빌드 플러그인을 쓰면 이 순서가 자동으로 처리된다.

API

  • createRenderCollector() — Collector 팩토리. React 커밋마다 non-host fiber에 대해 RenderSignal을 내보낸다.
  • resolveComponentFromElement(el) — DOM 엘리먼트를 받아 가장 가까운 React 컴포넌트 이름을 반환한다 (없으면 null).
  • installDevToolsHook(listener) — 저수준 DevTools 훅 설치 함수. unsubscribe 함수를 반환한다.
  • fiberComponentName(fiber) — fiber를 컴포넌트 이름으로 해석한다.
  • walkChangedFibers(root, visit, { stopAt }) — 상한선을 두고 fiber 서브트리를 깊이 우선으로 순회한다.