Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@assistant-ui/tap

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@assistant-ui/tap

Zero-dependency reactive state management inspired by React hooks

latest
Source
npmnpm
Version
0.5.14
Version published
Maintainers
2
Created
Source

@assistant-ui/tap

npm version npm downloads bundle size GitHub stars

Reactive primitives that bring React's hook mental model outside of components. The core has zero runtime dependencies and works in vanilla JS, on a server, or in React via the optional /react sub-path. Define self-contained units of state and effects (Resources) using tapState, tapEffect, tapMemo, and friends, and consume them via useResource.

tap powers the runtime layer of assistant-ui. Most users do not install it directly; reach for @assistant-ui/react instead.

Installation

npm install @assistant-ui/tap

Usage

import { resource, tapState, tapEffect, createResourceRoot } from "@assistant-ui/tap";

const Counter = resource(({ incrementBy = 1 }: { incrementBy?: number }) => {
  const [count, setCount] = tapState(0);

  tapEffect(() => {
    console.log("count:", count);
  }, [count]);

  return {
    count,
    increment: () => setCount((c) => c + incrementBy),
  };
});

const root = createResourceRoot();
const counter = root.render(Counter({ incrementBy: 2 }));

const unsubscribe = counter.subscribe(() => {
  console.log("counter updated:", counter.getValue().count);
});

counter.getValue().increment();

In React, use the useResource hook from the /react sub-path:

import { useResource } from "@assistant-ui/tap/react";

function CounterButton() {
  const { count, increment } = useResource(Counter({ incrementBy: 1 }));
  return <button onClick={increment}>{count}</button>;
}

Hooks

tapState, tapEffect, tapMemo, tapCallback, tapRef mirror their React counterparts. Additional primitives include tapResource and tapResources for composition, plus createResourceContext / tap / withContextProvider for context.

Full API reference at assistant-ui.com/tap/docs.

License

MIT

Keywords

state-management

FAQs

Package last updated on 31 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts