API Reference
Hooks
The following React hooks are available. Use these in custom components and pages.
Data Hooks
usePosts
Fetch a paginated list of posts, with load-more support and optional filtering.
Options
Prop
Type
Result
Prop
Type
usePost
Fetch a single post by slug
.
Parameters
- slug: string | undefined
Result
Prop
Type
useTagPosts
Fetch posts filtered by tag with pagination.
Parameters
- tag: string | undefined
Result
Prop
Type
useTags
Fetch all unique tags across posts.
Options
This hook has no options.
Result
Prop
Type
useDrafts
Fetch draft posts with pagination.
Options
This hook has no options.
Result
Prop
Type
usePostSearch
Search posts by free-text query. Internally composes usePosts
with debouncing.
Options
Prop
Type
Result
Prop
Type
Misc
Mutations
Perform create/update/delete operations on posts. These return TanStack Query mutation objects.
useCreatePost — Result
Prop
Type
useUpdatePost — Result
Prop
Type
useDeletePost — Result
Prop
Type
Context & Routing
Utilities for consuming Better Blog context and routing information.
useBlogContext — Result
Prop
Type
useComponents — Result
Prop
Type
useBasePath — Result
Returns: string
useBlogPath — Parameters & Result
- Parameters:
(...segments: Array<string | number | undefined | null>)
- Returns: string
useRoute — Result
Prop
Type