Skip to content

Commit 23e5a43

Browse files
authored
Merge pull request #20 from data-miner00/dev2
Minor updates
2 parents 0b196a9 + acd75e7 commit 23e5a43

File tree

5 files changed

+46
-2
lines changed

5 files changed

+46
-2
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,15 @@
6767
"typescript": "^4.9.5"
6868
},
6969
"dependencies": {
70+
"@uidotdev/usehooks": "^2.0.1",
7071
"framer-motion": "^7.10.3",
7172
"i18next": "^22.5.1",
7273
"react": "^18.2.0",
7374
"react-dom": "^18.2.0",
7475
"react-i18next": "^12.3.1",
7576
"react-icons": "^4.10.1",
7677
"react-router-dom": "^6.14.1",
78+
"web-vitals": "^3.4.0",
7779
"zod": "^3.21.4"
7880
}
7981
}

pnpm-lock.yaml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const About = lazy(async () => await import("./pages/About"));
1313
const NotFound = lazy(async () => await import("./pages/NotFound"));
1414

1515
const App = (): JSX.Element => (
16-
<div>
16+
<>
1717
<Header />
1818
<ReferencePane />
1919

@@ -27,7 +27,7 @@ const App = (): JSX.Element => (
2727
</Routes>
2828
</React.Suspense>
2929
</ErrorBoundary>
30-
</div>
30+
</>
3131
);
3232

3333
export default App;

src/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { BrowserRouter } from "react-router-dom";
44

55
import App from "./App";
66
import ErrorBoundary from "./components/ErrorBoundary";
7+
import reportWebVitals from "./reportWebVitals";
78

89
import "./i18n";
910

@@ -19,3 +20,6 @@ root.render(
1920
</ErrorBoundary>
2021
</React.StrictMode>
2122
);
23+
24+
// Pass in `console.log` for web vitals reporting
25+
reportWebVitals();

src/reportWebVitals.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { ReportCallback } from "web-vitals";
2+
3+
const reportWebVitals = (onPerfEntry?: ReportCallback): void => {
4+
if (onPerfEntry != null) {
5+
import("web-vitals")
6+
.then(({ onCLS, onFCP, onFID, onLCP, onTTFB }) => {
7+
onCLS(onPerfEntry);
8+
onFID(onPerfEntry);
9+
onFCP(onPerfEntry);
10+
onLCP(onPerfEntry);
11+
onTTFB(onPerfEntry);
12+
})
13+
.catch(console.error);
14+
}
15+
};
16+
17+
export default reportWebVitals;

0 commit comments

Comments
 (0)