Fallback true returns error while deployment

snehendu_roy_

Snehendu Roy

Posted on March 29, 2022

Fallback true returns error while deployment

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
   }
}
Enter fullscreen mode Exit fullscreen mode

To solve this, you must handle the data coming from getStaticProps() in your component

export default function App({data}) {
  if (!data) return null;
}
Enter fullscreen mode Exit fullscreen mode

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_
Snehendu Roy

Posted on March 29, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related