Files
server-components-demo/public/index.html
Lauren Tan 74f4274996 Initial commit
Co-authored-by: Dan Abramov <dan.abramov@me.com>
Co-authored-by: Sebastian Markbåge <sema@fb.com>
Co-authored-by: Joseph Savona <josephsavona@users.noreply.github.com>
Co-authored-by: Andrew Clark <git@andrewclark.io>
2020-12-21 11:01:40 -05:00

33 lines
1.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="description" content="React with Server Components demo">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="style.css" />
<title>React Notes</title>
</head>
<body>
<div id="root"></div>
<script>
// In development, we restart the server on every edit.
// For the purposes of this demo, retry fetch automatically.
let nativeFetch = window.fetch;
window.fetch = async function fetchWithRetry(...args) {
for (let i = 0; i < 4; i++) {
try {
return await nativeFetch(...args);
} catch (e) {
if (args[1] && args[1].method !== 'GET') {
// Don't retry mutations to avoid confusion
throw e;
}
await new Promise(resolve => setTimeout(resolve, 500));
}
}
return nativeFetch(...args);
}
</script>
</body>
</html>