marktforsyth / ForsythRecipes

https://freshipes.shadowfire168.repl.co
1 stars 0 forks source link

Doesn't throw 404 in dynamic pages directories #4

Closed marktforsyth closed 4 years ago

marktforsyth commented 4 years ago

When I go into the recipes or categories directory in the URL, and type in a recipe or category that doesn't exist, it throws an error in React itself, because it can't find the given value in the database. Instead, I want it to give me the 404 page.

We did something similar in devcamp, I wonder if any of that could be applied/adapted here?

marktforsyth commented 4 years ago

https://nextjs.org/docs/basic-features/data-fetching#the-fallback-key-required This looks like it may have the solution.

marktforsyth commented 4 years ago

Eperedo https://blog.eperedo.com/2019/07/28/learning-nextjs-day-eleven-custom-error-page/ had exactly what I needed.