Fetch comments for a project
Endpoint
https://developer.thefullstack.network/api/v1/project/comments/:projectId
Example request
import useSWR from "swr";
import fetcher from "utils/fetcher";
const Comments = () => {
const url = `/api/v1/project/comments/62ab14ae1dc5194b2487ee87`;
const { data } = useSWR(url, fetcher);
return data.map((comment, index) => (
<div key={index}>{comment.comment_text} ...</div>
));
};
export default Comments;
Example response
[
{
"comment_author": "MattWhite",
"comment": "This actually came up in a Reddit chat yesterday...Gonna share this to the OP over there",
"comment_like_count": 1,
"created_at": "2022-11-17T13:18:19.273Z"
},
{
"comment_author": "BeshoyHanna",
"comment": "Such a simple app but somehow too expensive or difficult to implement!",
"comment_like_count": 1,
"created_at": "2022-11-30T22:09:19.835Z"
},
{
"comment_author": "JonasVanderberg",
"comment": "Ok this is cool I'll dm you and I'd like to see if I can use this myself",
"comment_like_count": 0,
"created_at": "2022-12-06T23:36:53.251Z"
}
]