Skip to content

Instantly share code, notes, and snippets.

View ncesar's full-sized avatar
🎯
Focusing

César Nascimento ncesar

🎯
Focusing
View GitHub Profile
@ncesar
ncesar / React.unstable_Profiler.md
Created June 30, 2020 17:06 — forked from bvaughn/React.unstable_Profiler.md
Notes about the in-development React <Profiler> component

Profiler

React 16.4 will introduce a new Profiler component (initially exported as React.unstable_Profiler) for collecting render timing information in order to measure the "cost" of rendering for both sync and async modes.

Profiler timing metrics are significantly faster than those built around the User Timing API, and as such we plan to provide a production+profiling bundle in the future. (The initial release will only log timing information in DEV mode, although the component will still render its children- without timings- in production mode.)

How is it used?

Profiler can be declared anywhere within a React tree to measure the cost of rendering that portion of the tree. For example, a Navigation component and its descendants: