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

react-alien-signals

v0.3.0

Published

Readme

React Alien Signals

License npm Build

React Alien Signals is a TypeScript library that provides hooks built on top of Alien Signals. It offers a seamless integration with React, ensuring concurrency-safe re-renders without tearing.

Table of Contents

Features

  • Basic Signals: Create and manage reactive state with createSignal
  • Computed Signals: Derive reactive values based on other signals using createComputed
  • Effects & Effect Scopes: Run side effects in response to state changes with createEffect and manage multiple effects with createSignalScope
  • React Integration: Utilize hooks like useSignal, useSignalValue, and useSetSignal for seamless state management
  • TypeScript Support: Fully typed APIs for type safety and IntelliSense

Installation

Install react-alien-signals and its peer dependency alien-signals via npm:

npm install react-alien-signals alien-signals

Usage

Basic Signals

Create a writable signal and use it within your components:

import { createSignal, useSignal } from "react-alien-signals";

const count = createSignal(0);

function Counter() {
  const [value, setValue] = useSignal(count);

  return (
    <button onClick={() => setValue(value + 1)}>
      Count: {value}
    </button>
  );
}

Computed Signals

Create derived state that automatically updates:

import { createSignal, createComputed, useSignalValue } from "react-alien-signals";

const count = createSignal(1);
const double = createComputed(() => count() * 2);

function Display() {
  const doubleValue = useSignalValue(double);
  return <div>Double: {doubleValue}</div>;
}

Effects & Effect Scopes

Run side effects in response to signal changes:

import { createSignal, createEffect, useSignalScope } from "react-alien-signals";

const count = createSignal(0);

function Logger() {
  useSignalScope(() => {
    createEffect(() => {
      console.log('Count changed:', count());
    });
  });

  return null;
}

React Hooks

React Alien Signals provides several hooks to interact with signals:

  • useSignal(signal): Returns [value, setValue] tuple for reading and writing
  • useSignalValue(signal): Returns the current value (read-only)
  • useSetSignal(signal): Returns a setter function (write-only)
  • useSignalEffect(effectFn): Runs a side effect based on signal changes
  • useSignalScope(callback): Manages effect scopes within a component
  • useComputed(getter, deps): Creates and subscribes to a computed signal

useComputed(getter, deps)

The useComputed hook expects a getter and a dependency array. The dependency array is similar to a dependency array used in useMemo or useEffect Here is an example

function Component({ a }) {
  useComputed(
    () => {
      return a + mySignal();
    },
    [a, mySignal]
  );
}

Contributing

Contributions are welcome! Please read the Contributing Guidelines before getting started.

License

MIT

Acknowledgements