import React from "react"; import Router from "next/router"; import ReactMarkdown from "react-markdown"; export type PostProps = { id: number; title: string; author: { name: string; email: string; } | null; content: string; published: boolean; }; const Post = ( {post} : {post : PostProps}) => { const authorName = post.author ? post.author.name : "Unknown author"; return (
Router.push("/p/[id]", `/p/${post.id}`)}>

{post.title}

By {authorName}
); }; export default Post;