-
Notifications
You must be signed in to change notification settings - Fork 0
React Hooks
github-actions[bot] edited this page Jun 26, 2026
·
2 revisions
@rankmyseo/react provides hooks that talk to the RankMySEO HTTP API. Wrap your app in RankMySeoProvider.
import { RankMySeoProvider, createRankMySeoClient } from "@rankmyseo/react";
const client = createRankMySeoClient({
baseUrl: "http://localhost:3456",
tenantId: "tenant-a",
projectId: "project-1",
});
export function App() {
return (
<RankMySeoProvider client={client}>
<Dashboard />
</RankMySeoProvider>
);
}Load and update dashboard widget layout.
const { config, loading, error, updateConfig } = useDashboardConfig();
// config.widgets — array of WidgetConfig
await updateConfig({ widgets: [...] });const { keywords, loading, createKeyword, deleteKeyword } = useKeywords();Historical rank snapshots for charting.
const { snapshots, loading } = useRankTracker({ keywordId: "kw-1" });const { audits, loading, runAudit } = useAudit();const { report, loading, generate } = useReport();Live URL scan (title, meta, headings, links, images).
const { scan, scanning, result, error } = useScan();
await scan({ url: "https://example.com" });Generate SEO meta title and description.
const { generate, generating, result } = useMetaGenerator();
await generate({
title: "Best Rank Trackers",
content: "...",
targetKeyword: "rank tracker",
});Generate Schema.org JSON-LD (Article, Product, FAQPage, BreadcrumbList, Organization).
const { generate, generating, result } = useSchemaGenerator();
await generate({
type: "FAQPage",
questions: [{ question: "What is RankMySEO?", answer: "An SEO toolkit." }],
});Full blog CRUD when siteFeatures.blog is enabled.
const {
posts,
loading,
createPost,
updatePost,
deletePost,
getPost,
} = useBlog();Opt-in blog widget management.
const { enabled, enable, disable, options } = useBlogModule();
// enable() adds BlogManager to dashboard config
// disable() removes itStreaming AI agent chat (requires agent server).
const { messages, send, streaming } = useRankMySeoChat();All hooks expose error where applicable. HTTP errors surface as Error with message from API body when available.
Types re-export from @rankmyseo/core where possible. Import schemas for form validation:
import { blogPostSchema } from "@rankmyseo/core";See API-Reference for endpoint details each hook calls.