Próximas páginas JS com rotas dinâmicas

// create a file in pages/posts/[id].js
//then it will be find at posts/1 , posts/2, ..

//file->  pages/posts/[id].js
import { useRouter } from 'next/router'

const Post = () => {
  const router = useRouter()
  const { id } = router.query

  return <p>Post: {id}</p>
}

export default Post
CodePadding