npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mojimoto/react

v0.2.0

Published

React components and hooks for rendering Mojimoto CMS content (rich text, images, links).

Readme

@mojimoto/react

React components and hooks for rendering Mojimoto content. Works with React 18 & 19, in both Client and Server Components (and therefore Next.js). For Next-specific data fetching and Draft Mode, add @mojimoto/next.

npm i @mojimoto/react @mojimoto/client

Components

<MojiRichText>

Renders a rich_text field with sensible HTML defaults. Override any block or span via components.

import { MojiRichText } from '@mojimoto/react';

<MojiRichText field={doc.data.body} />

// Customize specific nodes — everything else keeps its default:
<MojiRichText
  field={doc.data.body}
  components={{
    heading2: ({ children }) => <h2 className="text-2xl font-serif">{children}</h2>,
    hyperlink: ({ node, children }) => (
      <a className="underline" href={(node.data as any).url}>{children}</a>
    ),
  }}
  linkResolver={(link) => `/${link.uid}`}
  fallback={<p className="text-stone-400">No content yet.</p>}
/>

Keys are handled automatically — your override functions never need to set key.

| Prop | Type | Description | | --- | --- | --- | | field | MojiRichText \| null | The field value. | | components | MojiRichTextComponents<ReactNode> | Per-node overrides. | | linkResolver | (link) => string | Resolves document links to hrefs. | | fallback | ReactNode | Rendered when the field is empty. |

<MojiImage>

Renders a media URL string or a rich-text image node.

import { MojiImage } from '@mojimoto/react';

<MojiImage field={doc.data.background_image} alt="Hero" className="w-full" />

// Append transform params (when image transforms are enabled on your CMS):
<MojiImage field={doc.data.background_image} transform={{ width: 1280, format: 'webp', quality: 80 }} />

<MojiText>

Renders a rich_text field as plain text (formatting stripped) — for headings, excerpts, <title>.

<MojiText field={doc.data.intro} as="h1" />

<MojiLink>

Renders a link field/span as <a>, or any component via as (e.g. Next's Link).

import Link from 'next/link';
import { MojiLink } from '@mojimoto/react';

<MojiLink field={doc.data.cta_link} as={Link} className="btn">Get started</MojiLink>

Provider (optional)

<MojimotoProvider> supplies a default linkResolver, default rich-text components, and a client for the hooks — so you configure them once.

import { MojimotoProvider } from '@mojimoto/react';
import { createClient } from '@mojimoto/client';

const cms = createClient({ endpoint, project, token });

<MojimotoProvider client={cms} linkResolver={(l) => `/${l.uid}`}>
  <App />
</MojimotoProvider>

Precedence for rich-text components: per-call components prop > provider richTextComponents > built-in defaults.

Hooks (Client Components)

For 'use client' components. In Server Components, just call the client directly.

'use client';
import { useMojiQuery, useMojiDocument } from '@mojimoto/react';

function Posts() {
  const { data, loading, error } = useMojiQuery({ type: 'blog_post', perPage: 10 });
  if (loading) return <Spinner />;
  if (error) return <Error message={error.message} />;
  return data!.map((p) => <Card key={p.id} post={p} />);
}

Requires a client in <MojimotoProvider>. Requests abort automatically on unmount / arg change.

Next.js (Server Components)

// app/[uid]/page.tsx
import { createMojimotoClient } from '@mojimoto/next';
import { MojiRichText } from '@mojimoto/react';

const cms = createMojimotoClient({ endpoint, project, token, revalidate: 60 });

export default async function Page({ params }: { params: Promise<{ uid: string }> }) {
  const { uid } = await params;
  const doc = await cms.byUid('marketing_page', uid);
  if (!doc) notFound();
  return <MojiRichText field={doc.data.body} />;
}

See @mojimoto/next for caching and Draft Mode.

A note on embeds

The default embed renderer injects provider oEmbed HTML via dangerouslySetInnerHTML. That HTML originates from your CMS's oEmbed provider (editor-controlled, same trust model as Prismic/Contentful renderers). If you embed untrusted third-party content, override the embed component to sanitize or render an iframe yourself.

License

MIT © Your Ikigai Ltd