i am new to next js and
i been trying to to use getStaticProps in my dymnamic pages in my next js
and i get this error
Error: getStaticPaths is required for dynamic SSG pages and is missing for ‘/query/[itmid]’
[itmid].jsx
function Query({ posts }) {
return (
{posts.map((itm, k) => {
return (
<>
<Head>
<title> {itm.Name} - wixten </title>
</Head>
<div key={itm._id} className="Question-one">
<h1> {itm.Name}</h1>
<h2>{itm.Summary}</h2>
</div>
<div className="username">
<span className="username2">--{itm.username}</span>
</div>
</>
);
})}
</>
<div className="multi-container">
<Answershooks id={gotid} />
<RealtedPost />
</div>
</>
);
}
export async function getStaticProps() {
const res = await fetch("https://ask-over.herokuapp.com/questone/" + gotid);
console.log("check");
console.log("dada");
const posts = await res.json();
return {
props: {
posts,
},
};
}
export default Query;
why am i getting this error can someone pls help me
i am egtiign this error
Server Error
Error: getStaticPaths is required for dynamic SSG pages and is missing for ‘/query/[itmid]’.