A Babel plugin that wraps components with Profiler.
For Yarn
yarn add -D babel-plugin-wrap-profiler
For npm
npm install --save-dev babel-plugin-wrap-profiler
// In your .babelrc
{
"plugins": [
"babel-plugin-wrap-profiler"
]
}
// In your code
import React from 'react';
import { logComponents } from "babel-plugin-wrap-profiler/lib/profiler-utils";
const Component = () => {
return (
<button onClick={logComponents}>
Log Components
</button>
);
};
- Thanks to CoinBase for the inspiration.
- Jamie for Babel plugin handbook