Out of curiosity and finding ways to understand how reactjs works. I want to know the use of this file in a react boilerplate app. I am new to react.
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;
CodePudding user response:
With the reportWebVitals
function, you can send any of the results to an analytics endpoint to measure and track real user performance on your site.
For more information and examples visit the documentation here.