Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
NextJS fetch data for dynamic route

This is my route:

post/[id].tsx

And this my code:

export async function getStaticPaths() {
    return {
        paths: [{ params: { 'id': '200'} }],
        fallback: true
    };
}

export async function getStaticProps({ params }) {
    const res = await fetch(`https://api.com/${params.id}`)
    const post = await res.json()
    return { props: { post } }
}

I have 2 problems:

1- How can I pass my custom params to paths?

2- After run the code, my page rendered twice

I don't want get all ids in getStaticPaths

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!