18 lines
486 B
TypeScript
18 lines
486 B
TypeScript
|
import { useParams } from "@solidjs/router";
|
||
|
import { Show, Suspense, createResource } from "solid-js";
|
||
|
import { getPost } from "./api";
|
||
|
import { PostSegment } from "./Posts";
|
||
|
|
||
|
export function SinglePost() {
|
||
|
const params = useParams();
|
||
|
const [post] = createResource(params.postid, getPost);
|
||
|
|
||
|
return (
|
||
|
<Suspense fallback={<div>Some loading message</div>}>
|
||
|
<Show when={post()}>
|
||
|
<PostSegment post={post()!}></PostSegment>
|
||
|
</Show>
|
||
|
</Suspense>
|
||
|
);
|
||
|
}
|