I am currently developing a Next.js application. Here is the structure of my files:
cpanearme
-components
-listitem.js
-pages
-home
-index.js
-firm
-[id].js
Below is the code for a list item that redirects to the dynamic route:
<a className='lead'
onClick={() => {
router.push({
pathname: `/firm/${firm.id}`,
query: { data: firm.id},
})
}}
>View Their Profile and Reviews</a>
The following is the complete dynamic page setup:
import { withRouter } from 'next/router'
import Image from 'next/image'
import Link from 'next/link'
import StickyNavbar from '../../components/StickyNavbar'
import ReviewItem from "../../components/ReviewItem"
import Footer from '../../components/Footer'
import path from "path"
import fs from "fs"
<!-- Rest of the JavaScript code -->
During the building phase, I encountered an error after implementing getStaticPaths
. The specific issue is perplexing and does not yield relevant results when searched online.
Error: Export encountered errors on following paths:
/firm/[id]
/taxfaqs/[id]
Although everything passes successfully with get static props, I am unsure how to address the error related to [id]
. Could it possibly be [...id]
instead?