Coding task · JavaScript and React course · Module 10: React Ecosystem and Future

Practice: Performance Observatory

In 2026 the Core Web Vitals are LCP (how fast the main content shows up), INP (the delay in responding to an interaction, which replaced FID in 2024) and CLS (layout shifts). Each has two thresholds: up to the first one the result is good, up to the second it needs improvement, above it is poor. In an app the values are collected by the web-vitals library (onLCP, onINP, onCLS), and the panel only rates and displays them.

Task

Finish the Core Web Vitals panel of the observatory. Thresholds (web.dev): LCP is good up to 2500 ms and needs improvement up to 4000 ms; INP is good up to 200 ms and needs improvement up to 500 ms; CLS is good up to 0.1 and needs improvement up to 0.25; above that it is poor. ___BLANK1___: rateMetric returns needs-improvement when the value does not exceed the poor threshold of that metric (the threshold itself counts). ___BLANK2___: the card border colour is the colour of the rating from the COLORS object. ___BLANK3___: summarize increases by 1 the counter of the category the metric falls into. For the probe measurements the summary is: 1 good, 1 needs improvement, 1 poor.