diff --git a/examples/blog-starter/lib/api.js b/examples/blog-starter/lib/api.js index f684833c7c130..08da07eb78ab8 100644 --- a/examples/blog-starter/lib/api.js +++ b/examples/blog-starter/lib/api.js @@ -38,6 +38,6 @@ export function getAllPosts(fields = []) { const posts = slugs .map((slug) => getPostBySlug(slug, fields)) // sort posts by date in descending order - .sort((post1, post2) => (post1.date > post2.date ? '-1' : '1')) + .sort((post1, post2) => (post1.date > post2.date ? -1 : 1)) return posts } diff --git a/examples/with-google-tag-manager/components/GoogleTagManager.js b/examples/with-google-tag-manager/components/GoogleTagManager.js index 49b89be14c5f2..2be552492624d 100644 --- a/examples/with-google-tag-manager/components/GoogleTagManager.js +++ b/examples/with-google-tag-manager/components/GoogleTagManager.js @@ -2,17 +2,13 @@ import { useEffect } from 'react' import { useRouter } from 'next/router' import * as gtm from '../lib/gtm' -const handleRouteChange = () => { - gtm.pageview() -} - const GoogleTagManager = ({ children }) => { const router = useRouter() useEffect(() => { - router.events.on('routeChangeComplete', handleRouteChange) + router.events.on('routeChangeComplete', gtm.pageview) return () => { - router.events.off('routeChangeComplete', handleRouteChange) + router.events.off('routeChangeComplete', gtm.pageview) } }, [router.events])