Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
fix: use next/router instead of react-router-dom
Browse files Browse the repository at this point in the history
  • Loading branch information
TimotheeMalard committed Mar 1, 2024
1 parent 4bccf79 commit d846fdd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 26 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"react": "18.1.0",
"react-dom": "18.1.0",
"react-markdown": "^8.0.3",
"react-router-dom": "^6.22.2",
"sass": "^1.52.3",
"sharp": "^0.30.7",
"ua-parser-js": "^1.0.2"
Expand Down
16 changes: 11 additions & 5 deletions src/hooks/useTrackPage.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';
import Router from 'next/router';
import { trackPage } from '../services/pirschClient';

const useTrackPage = () => {
const location = useLocation();

useEffect(() => {
trackPage().catch(console.error);
}, [location.pathname]);
const handleRouteChange = () => {
trackPage().catch(console.error);
};

Router.events.on('routeChangeComplete', handleRouteChange);

return () => {
Router.events.off('routeChangeComplete', handleRouteChange);
};
}, []);
};

export default useTrackPage;
20 changes: 0 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1371,11 +1371,6 @@
resolved "https://registry.yarnpkg.com/@prismicio/types/-/types-0.2.8.tgz#76a0eb2f657a87f003ec81b654c8d72dbcd3228b"
integrity sha512-EmuYYil56U+UtEifMD/9TmLzpWliV+X6kypwPq47GNXmIXyFK1JsP3z872fUziXwoBjd2YILj28DNdYXlLOpXg==

"@remix-run/router@1.15.2":
version "1.15.2"
resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.15.2.tgz#35726510d332ba5349c6398d13259d5da184553d"
integrity sha512-+Rnav+CaoTE5QJc4Jcwh5toUpnVLKYbpU6Ys0zqbakqbaLQHeglLVHPfxOiQqdNmUy5C2lXz5dwC6tQNX2JW2Q==

"@rushstack/eslint-patch@^1.1.3":
version "1.3.2"
resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.3.2.tgz#31b9c510d8cada9683549e1dbb4284cca5001faf"
Expand Down Expand Up @@ -7095,21 +7090,6 @@ react-markdown@^8.0.3:
unist-util-visit "^4.0.0"
vfile "^5.0.0"

react-router-dom@^6.22.2:
version "6.22.2"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.22.2.tgz#8233968a8a576f3006e5549c80f3527d2598fc9c"
integrity sha512-WgqxD2qySEIBPZ3w0sHH+PUAiamDeszls9tzqMPBDA1YYVucTBXLU7+gtRfcSnhe92A3glPnvSxK2dhNoAVOIQ==
dependencies:
"@remix-run/router" "1.15.2"
react-router "6.22.2"

react-router@6.22.2:
version "6.22.2"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.22.2.tgz#27e77e4c635a5697693b922d131d773451c98a5b"
integrity sha512-YD3Dzprzpcq+tBMHBS822tCjnWD3iIZbTeSXMY9LPSG541EfoBGyZ3bS25KEnaZjLcmQpw2AVLkFyfgXY8uvcw==
dependencies:
"@remix-run/router" "1.15.2"

react@18.1.0:
version "18.1.0"
resolved "https://registry.yarnpkg.com/react/-/react-18.1.0.tgz#6f8620382decb17fdc5cc223a115e2adbf104890"
Expand Down

0 comments on commit d846fdd

Please sign in to comment.