Next Js by itself is a super power over react. With its functions like getStaticPaths()
and getDtaticProps()
, dynamic page generation becomes truly easy.
But in most cases, fallback true returns error during deployment
export async function getStaticPaths() {
returns {
paths: paths,
fallback: true // returns erroe
}
}
To solve this, you must handle the data coming from getStaticProps()
in your component
export default function App({data}) {
if (!data) return null;
}
This simple one liner, at the top of your component page where getStaticPaths()
is used, can fix all the problems regarding this during deployment.
Top comments (0)