Skip to content

Commit c2b9c5d

Browse files
dynamic route
1 parent 3de1b8e commit c2b9c5d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

components/Post.tsx

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from 'react';
2+
import Link from 'next/link';
3+
4+
export type PostProps = {
5+
id: number;
6+
title: string;
7+
author: {
8+
name: string;
9+
email: string;
10+
} | null;
11+
content: string;
12+
published: boolean;
13+
};
14+
15+
const Post: React.FC<{ post: PostProps }> = ({ post }) => {
16+
return (
17+
<h1>
18+
<Link href={`/p/${post.id}`}>
19+
<a>{post.title}</a>
20+
</Link>
21+
</h1>
22+
);
23+
};
24+
25+
export default Post;

0 commit comments

Comments
 (0)