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

@makoojs/react

v0.1.4

Published

React adapter for the Makoo userscript development framework

Readme

@makoojs/react

@makoojs/react is Makoo's React mount adapter. It connects React components to the @makoojs/core adapter protocol, allowing the Makoo runtime to create React roots after target DOM nodes appear, render components, and unmount them correctly when tasks are destroyed or reset.

Use Cases

  • Inject React components in a Makoo project.
  • Let the @makoojs/core runtime recognize and mount React artifacts.
  • Register the React adapter manually when using the core runtime directly.
  • Read the Makoo task context makoo inside React components.

Installation

# npm install @makoojs/react
# yarn add @makoojs/react
pnpm add @makoojs/react

@makoojs/react depends on @makoojs/core and declares react and react-dom as peer dependencies, so make sure both react and react-dom are installed before using this package.

Makoo Context In React Components

The React adapter passes makoo to the component as props. Components can use it to read the current task ID, target selector, logger, or control the current task lifecycle.

import type { ReactMountProps } from '@makoojs/react';

export default function Badge({ makoo }: ReactMountProps) {
	return (
		<button
			type="button"
			onClick={() => {
				makoo.getLogger().info(`clicked ${makoo.taskId}`);
			}}
		>
			Makoo Badge
		</button>
	);
}

makoo comes from @makoojs/core's MakooContext. Common capabilities include:

| Capability | Description | | --- | --- | | taskId | Current injection task ID | | injectAt | Target selector for the current task | | enableAlive() / disableAlive() | Control alive reinjection for the current task | | reset() / destroy() | Reset or destroy the current task | | on() / onTask() | Listen to lifecycle observation events | | getLogger() | Get the current runtime logger |

Usage With @makoojs/core

Pass the React adapter to createMakoo(), then declare React component tasks with inject().

import { createMakoo, inject } from '@makoojs/core';
import { createReactAdapter } from '@makoojs/react';
import Badge from './Badge';

const makoo = createMakoo({
	defaults: {
		alive: true,
		scope: 'local',
		timeout: 5000
	},
	adapters: [createReactAdapter()]
});

makoo.start([
	inject({
		id: 'badge',
		injectAt: '#app',
		artifact: Badge
	})
]);

The adapter returned by createReactAdapter() will:

  • Create a React root with react-dom/client's createRoot(mountPoint).
  • Render the component with root.render(createElement(artifact, { makoo })).
  • Call root.unmount() during unmount.
  • Wrap mount/unmount failures as ReactAdapterError.

Type Exports

@makoojs/react exports these commonly used types:

| Type | Description | | --- | --- | | ReactMountProps | Props received by the React component, including makoo | | ReactMountArtifact | React artifact type recognized by Makoo | | ReactMountAdapter | React adapter type | | ReactMountRoot | React root handle type |

It also exports:

  • createReactAdapter
  • ReactAdapterError

See the React API documentation for complete interface details.

Relationship With Other Packages

| Package | Responsibility | | --- | --- | | @makoojs/react | React mount adapter | | @makoojs/core | Provides the runtime API, adapter protocol, and Makoo runtime context | | @makoojs/cli | Provides development and build capabilities for Makoo projects |

@makoojs/react works with the injection runtime provided by @makoojs/core.