Skip to content

Instantly share code, notes, and snippets.

View mikelfcosta's full-sized avatar

Michel Costa mikelfcosta

  • lululemon athletica
  • Calgary, Alberta, Canada
View GitHub Profile
@mikelfcosta
mikelfcosta / anyComponent.jsx
Last active October 9, 2019 17:29
A basic log object and React 16.9 Profiler callback function to evaluate the number and speed of mounts and updates of a React component. Useful for testing tiny differences in components like if the usage of useMemo or useCallback hooks are improving or worsening the Component.
import React, {Profiler} from 'react';
import callback from './profiler';
function anyComponent() {
return (
<Profiler id="any-component" onRender={callback}>
<div>Some Component</div>
</Profiler>
);
}