-1

my folder structure:

enter image description here

also my code:

const router = useRouter();
const { id } = router.query;

so the problem is the id is returning {} and is not returning the id in the URL. it works fine when I put it in jsx but not when I put it in js

Shahab Athar
  • 110
  • 1
  • 3
  • 14

1 Answers1

1

you should name folder is "duc" or "product" or ... and in folder name js should [id].js for dynamic route , not index.js

Dynamic Routes

H9ee
  • 277
  • 2
  • 9