Skip to main content

Overview

Returns a function that fetches the paginated list of accepted connections for the currently authenticated user. Each entry includes the connected user’s profile and timestamps. For fetching another user’s connections, see useFetchConnectionsByUserId.

Usage Example

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

function ConnectionsList() {
  const fetchConnections = useFetchConnections();
  const [connections, setConnections] = useState([]);

  useEffect(() => {
    fetchConnections({ page: 1, limit: 20 }).then((res) => {
      setConnections(res.data);
    });
  }, []);

  return (
    <ul>
      {connections.map(({ id, connectedUser }) => (
        <li key={id}>{connectedUser.name}</li>
      ))}
    </ul>
  );
}

Parameters

The hook returns a function. That function accepts:
page
number
Page number to fetch. Defaults to 1.
limit
number
Number of results per page. Defaults to 20.

Returns

Returns a PaginatedResponse containing an array of established connections:
data
EstablishedConnection[]
Array of accepted connection entries.
pagination
object
Pagination metadata including page, pageSize, totalPages, totalItems, and hasMore.