Reputation: 3948
Following this guide, I created the following file in my project:
/pages/user/[id].js
class Post extends Component {
render() {
return (
<React.Fragment>
<Navbar />
<Content />
<Footer />
</React.Fragment>
);
}
}
export default Post;
But when I go to that URL, I get a 404.
What is the problem?
Upvotes: 0
Views: 317
Reputation: 5840
Assuming you're visiting (for example), http://localhost:3000/user/something
(where something
is your id
), try also visiting http://localhost:3000/user/something/
(note the backslash). This is currently a known issue in Next with dynamic routing.
(This also assumes you don't have pages/user/something.js
in your project as dynamic routes take a back seat to explicitly named routes.)
Upvotes: 2