{post.title}
{post.author}
•
{post.tags.length > 0 && (
{post.tags.map((tag) => (
{tag}
))}
)}
import { Link, useParams } from 'react-router-dom'; import { format } from 'date-fns'; import { getPost } from '../api'; import { useAsync } from '../lib/useAsync'; import CommentSection from '../components/CommentSection'; export default function PostPage() { const { slug = '' } = useParams(); const { data: post, loading, error } = useAsync(() => getPost(slug), [slug]); if (loading) return
Loading…
; if (error || !post) { return (That post doesn't exist. Browse the archive.