Unverified Commit c88bc178 authored by Jamie Kyle's avatar Jamie Kyle Committed by GitHub

Use an if statement instead of expression statement (#12747)

parent 87e096eb
...@@ -144,8 +144,11 @@ export function reportWebVitals(metric) { ...@@ -144,8 +144,11 @@ export function reportWebVitals(metric) {
const url = 'https://example.com/analytics' const url = 'https://example.com/analytics'
// Use `navigator.sendBeacon()` if available, falling back to `fetch()`. // Use `navigator.sendBeacon()` if available, falling back to `fetch()`.
;(navigator.sendBeacon && navigator.sendBeacon(url, body)) || if (navigator.sendBeacon) {
navigator.sendBeacon(url, body)
} else {
fetch(url, { body, method: 'POST', keepalive: true }) fetch(url, { body, method: 'POST', keepalive: true })
}
} }
``` ```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment