Fallback true returns error while deployment
Snehendu Roy
Posted on March 1, 2022
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 error
}
}
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.
💖 💪 🙅 🚩
Snehendu Roy
Posted on March 1, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.