
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
react-component-timing
Advanced tools
Monitor performance at a per component level
Current state is RFC 📄
If you like this idea, or have know of something like this that already exists, or have feedback before I start making anything, let me know!
We want to measure the load time of our apps in a way that,
There are a number of performance metrics that already exist
First meaningful paint provides a good way of measuring user experience, but requires knowledge of what "meaningful" is.
We also still need a good way to measure load times across "warm" page loads, as the first paint isn't the only one!
React component timing is a tool that helps you get the above data, so that when you try to move the needle, you actually move it for your users.
import * as React from "react";
import { ReactComponentTimingProvider } from "react-component-timing";
import { newRelicIntegration } from "./new-relic-timing-reporter";
import withData from "./app-data-provider";
export class AppImpl extends React.Component {
checkLoaded({ childTimings }) {
/* We have access to the timings of all of the children, through some magic */
return (
childTimings.nav.loaded &&
childTimings.article.loaded &&
this.props.data.loaded
);
}
render() {
return (
<ReactComponentTimingProvider reporter={newRelicIntegration}>
<Page>
<ReactComponentTiming
componentName="page"
checkLoaded={this.checkLoaded}
>
<Nav />
<Content>
<Article />
<Comments />
</Content>
</ReactComponentTiming>
</Page>
</ReactComponentTimingProvider>
);
}
}
export const App = withData(AppImpl);
import * as React from "react";
import { ReactCompomnentTiming } from "react-component-timing";
import { NavigationInner } from "./navigation-inner";
import withData from "./nav-data-provider";
class NavImpl extends React.Component {
checkLoaded() {
return this.props.data.loaded;
}
render() {
return (
<>
<ReactCompomnentTiming
componentName="nav"
checkLoaded={this.checkLoaded}
/>
<NavigationInner />
</>
);
}
}
export const Nav = withData(NavImpl);
(And similar for Comments and Article, which would both include dynamically loaded data)
✨ Through some wizardry and probably some API changes from the above, I think it'd be possible to implement something that would build a picture of the timing of when these "timing" components got rendered, and when they reported that they were loaded.
When props change (and are rerendered), a component can go into and out of a loading state. This loading state, and the reasons why, would be captured by the reporter.
This would let you define custom metrics, for, say, the comments component. You would be able to know a performance timing from cold page load to the comments being loaded, and how that is different on subsequent warm page loads.
The API also allows you to define "loading" states by composing your child loading states (possibly excluding some if they do not constitute "meaningful" for the parent component).
For what targets to hit, the rail guideline provides good information.
The RAIL framework: _ Response _ Animation _ Idle _ Load
This tool will help measure the Load and Response parts of this framework.
FAQs
Monitor performance at a per component level
The npm package react-component-timing receives a total of 2 weekly downloads. As such, react-component-timing popularity was classified as not popular.
We found that react-component-timing demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.