问题
I have a project with dynamic route like /[category]/[product]. After a client-side request via useRouter to graphql for example /hatchback/nissan/ returns a product with a code of 200, but if I make a request to /hatchback/nissan111/, I get an error because no such route exists and its response code still of 200 instead of 404. How can I check if a route exists and return a 404 status code during the component mount stage? I use SSR to achive this
来源:https://stackoverflow.com/questions/63877962/dynamic-routes-nextjs-with-status-code-404