1.0.1 • Published 4 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-vitals
Usage
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