22 lines
467 B
TypeScript
22 lines
467 B
TypeScript
|
import {
|
||
|
For,
|
||
|
JSXElement,
|
||
|
Show,
|
||
|
createResource,
|
||
|
createSignal,
|
||
|
useContext,
|
||
|
} from "solid-js";
|
||
|
|
||
|
import { getComments } from "../Util/api";
|
||
|
import { CommentSegment } from "./Comment";
|
||
|
|
||
|
export function CommentSection({ postId }: { postId: string }): JSXElement {
|
||
|
const [comments] = createResource(postId, () => getComments(postId, 0, 10));
|
||
|
|
||
|
return (
|
||
|
<For each={comments()!}>
|
||
|
{(comment) => <CommentSegment comment={comment} />}
|
||
|
</For>
|
||
|
);
|
||
|
}
|