Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 456 Bytes

README.md

File metadata and controls

19 lines (14 loc) · 456 Bytes

4 Ways to use dynamic routes in Next.js

This repo references four different ways to use dynamic routes in Next.js to make sure the route data gets to the page prior to trying use it.

Usage: Option 1

export default function Home() {
  const router = useRouter();
  const { name } = router.query;

  useEffect(() => {
    if (!router.isReady) return;
    //rest of code
  }, [router.query.name, router.isReady]);

  return <></>;
}