Relative Content

Tag Archive for next.jsgetstaticprops

how can getstaticprops have access to params or dynamic id when it only runs at build time?

export async function getStaticProps(staticProps) { const params = staticProps.params; return { props: { coffeeStore: coffeeStoresData.find((coffeeStore)=>{return coffeeStore.id === params.id}), }, }; } when we use dynamic route /coffee-store/1 params.id automatically takes value 1. my question is, in next.js, how can getstaticprops have access to params or dynamic id when it only runs at build time and […]