@scribe-atp/react
useSite
Section titled “useSite”function useSite(author: string, siteSlug: string): UseSiteResult
interface UseSiteResult { site: Site | null; loading: boolean; error: Error | null;}Fetches a site on mount and re-fetches whenever author or siteSlug changes. Aborts the in-flight request on unmount and on parameter change.
| Parameter | Type | Description |
|---|---|---|
author | string | Author handle or DID |
siteSlug | string | Site rkey — derive with toSlug(domain) |
While loading, site is null and loading is true. On error, site remains null and error is set. AbortError is swallowed and does not set error.
useArticle
Section titled “useArticle”function useArticle(author: string, articleSlug: string): UseArticleResult
interface UseArticleResult { article: Article | null; loading: boolean; error: Error | null;}Fetches an article on mount and re-fetches whenever author or articleSlug changes. Aborts on unmount and on parameter change.
| Parameter | Type | Description |
|---|---|---|
author | string | Author handle or DID |
articleSlug | string | Article rkey / slug |
Utilities
Section titled “Utilities”toSlug is re-exported for convenience:
import { toSlug } from '@scribe-atp/react';See toSlug in the core reference for details.
All types from @scribe-atp/core are re-exported:
import type { Site, Article, ArticleRef, SiteGroup } from '@scribe-atp/react';See the core reference for type definitions.