Skip to main content

Overview

useFetchSpaceBySlug returns a callable function that fetches a space using its slug. Slugs are optional, unique per project, and must match the pattern ^[\p{L}\p{N}]+(?:[-_][\p{L}\p{N}]+)*$ (letters, numbers, hyphens, underscores, supports Unicode).

Usage Example

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

function SpacePage({ slug }: { slug: string }) {
  const fetchSpace = useFetchSpaceBySlug();

  const handleFetch = async () => {
    const space = await fetchSpace({ slug });
    console.log(space.name);
  };
}

Parameters

slug
string
required
The URL slug of the space.
include
"files" | string[]
Optional. Pass "files" to include avatar and banner file objects.

Returns

Returns a SpaceDetailed object. For most use cases, prefer SpaceProvider slug prop over calling this hook directly.