bit of a newbie to nextjs.
I’m following a course of Max Schwarzmüller.
I have two questions:
When creating a dyanmic url, first, I attempted to create the folder/page as ‘blog’ which whenever trying to browse into the page it would say error 404. Changed to ‘blog(s)’ and it worked. Is there any particular reason ‘blog’ is not working for me ? also, when trying to output the params, it doesn’t show up in the html, but does in the console of the code editor. Code and Output attached.
Any help appreciated
2
Answers
The /blog should work. I recommend you restart VSCode after changing the file name if it doesn’t work.
Your params is "slugs", not "slug". And you console.log params object, so that shows the value in console, but HTML pointed wrong variable as params.slug.
It should be
params.slugs