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