FrostByte/client-solid/src/Components/CommentSection.tsx
2024-03-06 00:48:19 +01:00

21 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>
);
}