export async function getStaticPaths() {
const res = await fetch(`${baseUrl}/wp-json/wp/v2/posts`)
const posts = await res.json()
//paths is array of objects which is contains one params property with id or slug
const paths = posts.map(({ slug }) => ({ params: { slug: `${slug}` } }))
return {
paths,
//fallback true mean there is no slug in build time then it will not shown 404 error
// and fetch data from server and show it
fallback: true,
}
}