1.0.1 • Published 5 years ago
react-web-vitals v1.0.1
React Web Vitals
A React hook to print warnings if Web Vitals are above best practice thresholds.
Installation
yarn add react-web-vitalsUsage
Add the following hook to start monitoring web vitals:
import { useWebVitals } from 'react-web-vitals';
useWebVitals();Settings
The hook accepts an object with the following settings:
| Option | Description | Default |
|---|---|---|
| enabled | Enable reporting. | process.env.NODE_ENV !== 'production' |
| reporter | A custom reporter. | See code. |
Build setup
# Run tests
yarn run test
# Run linting checks
yarn run lint