nextjs compiled component does not fetch data

getStaticPath can only be called from page i.e index.js so you need to move the export getStaticProps to index.js and pass products as a prop to your products.js component.

Or if you want to fetch data on client you can use useEffect hook in your product component

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top