Skip to main content

Overview

useFetchCommentByForeignId returns a function that fetches a comment using the foreign ID from your own system. Useful when you’ve stored your own identifier on a comment and need to retrieve it later.

Usage Example

import { useFetchCommentByForeignId } from "@replyke/react-js";

function MyComment({ myCommentId }: { myCommentId: string }) {
  const fetchComment = useFetchCommentByForeignId();

  const load = async () => {
    const { comment } = await fetchComment({ foreignId: myCommentId });
    console.log(comment);
  };

  return <button onClick={load}>Load</button>;
}

Parameters

foreignId
string
required
The foreign ID to look up.
include
string | string[]
Populate related data. Accepted values: "user", "entity", "space", "parent".

Returns

comment
Comment
The fetched comment. See Comment data model.