Skip to content

@scribe-atp/react-router-framework

function createSiteLoader(
author: string,
siteSlug: string
): (args: LoaderFunctionArgs) => Promise<Site>

Returns a React Router loader function that fetches a site. The loader passes request.signal automatically so the fetch is cancelled if the user navigates away.

ParameterTypeDescription
authorstringAuthor handle or DID
siteSlugstringSite rkey — derive with toSlug(domain)
app/routes/blog.tsx
export const loader = createSiteLoader('alice.bsky.social', 'alice-bsky-social');

function createArticleLoader(
author: string,
articleSlug: string
): (args: LoaderFunctionArgs) => Promise<Article>

Returns a React Router loader function that fetches a single article. Useful when the slug is static (e.g. a featured article). For dynamic slugs from URL params, use fetchArticle from @scribe-atp/core directly inside your loader.

ParameterTypeDescription
authorstringAuthor handle or DID
articleSlugstringArticle rkey / slug

All types from @scribe-atp/core are re-exported:

import type { Site, Article, ArticleRef, SiteGroup } from '@scribe-atp/react-router-framework';

See the core reference for type definitions.