GetStaticPaths Not Working & No Errors
Answered
West African Lion posted this in #help-forum
West African LionOP
I'm not sure what I'm doing wrong here, but I'm unable to get NextJS to generate the pages pulled from Contentful. This is the same code I use in another project so I'm unsure what's going on. I'm able to pull the data on a different page in this project so I know the api keys & calls are correct
I'm just getting a
I'm just getting a
404 page saying the page wasn't found18 Replies
Answer
@@ts-ignore `getStaticPaths` works only in `pages` dir
West African LionOP
I see~ So what is the best practice solution here? Should I also make a pages directory, or is there a way for me to make this work with the app router?
West African LionOP
Thank you so much
I got it rendering
now just need to figure out why it isn't showing images but that's for tomorrow
Really appreciate the help @@ts-ignore â¤ï¸
So are
getStaticProps & getStaticPaths considered old now?@West African Lion So are `getStaticProps` & `getStaticPaths` considered old now?
no but they are for pages router
West African LionOP
If you don't mind me asking, what is the advantage of app router then? Why use one over another if I'm already familiar with the page routing
@West African Lion If you don't mind me asking, what is the advantage of app router then? Why use one over another if I'm already familiar with the page routing
app router brings so many features like RSC, server actions, layouts, parallel routes etc etc
West African LionOP
Ahhh okay got it
So page router isn't depricated but it is better to use app router if possible or the additional features are needed
?
@West African Lion So page router isn't depricated but it is better to use app router if possible or the additional features are needed
yes, pages router will still be supported for many upcoming major releases but it won't get any new features
only bug fixes
West African LionOP
Got it! So new projects should probably just go with the app router while old projects will still be supported and maintained without a rush to convert to the new app router
I think that clicks in my head now, thank you so so much â¤ï¸