Logochanges.page

React SDK

React components and hooks for embedding changelogs.

Installation

npm install @changespage/react react-markdown

Usage

"use client";

import { createChangesPageClient, usePosts, ChangelogPost } from "@changespage/react";
import Markdown from "react-markdown";

const client = createChangesPageClient({
  baseUrl: "https://your-page.changes.page",
});

function Changelog() {
  const { posts, hasMore, loading, loadMore } = usePosts({ client });

  if (loading) return <div>Loading...</div>;

  return (
    <div>
      {posts.map((post) => (
        <ChangelogPost key={post.id} post={post}>
          {({ title, plainText, tags, publicationDate }) => (
            <article>
              <h2>{title}</h2>
              <time>{publicationDate?.toLocaleDateString()}</time>
              <Markdown>{plainText}</Markdown>
            </article>
          )}
        </ChangelogPost>
      ))}
      {hasMore && <button type="button" onClick={loadMore}>Load More</button>}
    </div>
  );
}

API

usePosts(options)

Hook for fetching and managing posts.

OptionTypeDescription
clientChangesPageClientClient instance
initialDataUsePostsInitialDataSSR initial data (optional)
limitnumberPosts per page (default: 10)

Returns:

PropertyTypeDescription
postsPost[]Fetched posts
hasMorebooleanMore posts available
loadingbooleanLoading state
errorErrorError if any
loadMore() => voidLoad next page
refetch() => voidRefresh posts

<ChangelogPost>

Render prop component for displaying posts.

<ChangelogPost post={post}>
  {({ id, title, content, plainText, tags, publicationDate, url }) => (
    // Your custom UI
  )}
</ChangelogPost>

Re-exports

The React SDK re-exports everything from @changespage/core including createChangesPageClient, getTagLabel, and all types.

On this page