diff --git a/client-solid/src/Components/Comment.tsx b/client-solid/src/Components/Comment.tsx index 325d164..94fda21 100644 --- a/client-solid/src/Components/Comment.tsx +++ b/client-solid/src/Components/Comment.tsx @@ -1,4 +1,4 @@ -import { JSXElement } from "solid-js"; +import { JSXElement, splitProps } from "solid-js"; import { PublicComment } from "../Util/api"; @@ -7,12 +7,13 @@ interface CommentProps { } export function Comment(props: CommentProps): JSXElement { + const [local] = splitProps(props, ["comment"]); return ( <>
- +
-
{props.comment.content}
+
{local.comment.content}
); diff --git a/client-solid/src/Components/CommentSection.tsx b/client-solid/src/Components/CommentSection.tsx index 994553a..cb3b830 100644 --- a/client-solid/src/Components/CommentSection.tsx +++ b/client-solid/src/Components/CommentSection.tsx @@ -1,16 +1,18 @@ -import { For, JSXElement, createResource } from "solid-js"; +import { For, JSXElement, createResource, splitProps } from "solid-js"; import { getComments } from "../Util/api"; import { Comment } from "./Comment"; -export function CommentSection(props: { postId: string }): JSXElement { - const [comments] = createResource(props.postId, () => - getComments(props.postId, 10, 0) - ); +export function CommentSection(postId: { postId: string }): JSXElement { + const [local] = splitProps(postId, ["postId"]); + // Not sure why this is a resource, refetch is not implemented + const [state] = createResource(() => getComments(local.postId, 10, 0)); return ( -
- {(comment) => } -
+
+ Loading...
}> + {(comment) => } + +
); }