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

@lukekaalim/act

v4.0.0

Published

![NPM Version](https://img.shields.io/npm/v/%40lukekaalim%2Fact) ![npm package minimized gzipped size](https://img.shields.io/bundlejs/size/%40lukekaalim%2Fact)

Downloads

33

Readme

@lukekaalim/act

NPM Version npm package minimized gzipped size

Core library for act!

npm install @lukekaalim/act

Usage

Elements

Describe parts of (probably HTML) tree's with Elements!

An element is a string, number, array, boolean, null, or created by the createElement function (which is aliased to h for ease) with a "type", "props", and "children" arguments.

import { h } from '@lukekaalim/act';

const myArticle = h('article', {}, [
  h('h1', {}, 'My Article'),
  h('p', {},
    `This is the content of an article that I have written`
  ),
  h('button', { disabled: true }, `Can't click me!`)
])

Components

A function that returns some Elements is a Component! It takes in a single object argument, called "props". The Component interface takes a generic argument for the type of props.

import { h, Component } from '@lukekaalim';

type MyArticleComponentProps = {
  subject: string,
  contents: string[]
}

const MyArticleComponent: Component<MyArticleComponentProps> = ({
  subject,
  contents
}) => {
  return h('article', {}, [
    h('h1', {}, subject),
    contents.map(content => h('p', {}, content)),
    h('button', { disabled: true }, `Can't click me!`)
  ])
}

// elsewhere
h(MyArticleComponent, {
  subject: "The world",
  contents: ["This is a guide for how to take over the world."]
})

Hooks

Components can keep track of variables with useState, perform side effects on render with useEffect, get an instance of the underlying HTML element with useRef, and even cache precalculated values with useMemo.

import {
  useState, useEffect, useRef, useMemo,
  h
} from '@lukekaalim/act';

const MyInteractiveComponent = () => {
  const [name, setName] = useState('World');
  
  const ref = useRef<HTMLInputElement | null>(null);

  const guessedAge = useMemo(() => {
    return supercomputer.guessAgeFromName(name);
  }, [name])

  useEffect(() => {
    if (guessedAge > 80)
      window.alert("You are old!")
  }, [guessedAge])

  const onInput = (event: InputEvent) => {
    const input = ref.current;
    if (!input)
      return; 
    setName(input.value);
  }

  return [
    h('input', { ref, type: 'text', value: name, onInput }),
    h('p', {}, `Hello, ${name}!`)
  ];
}

Context

Create values in parents that can be read by children with createContext and useContext.

import { h, createContext, useContext } from '@lukekaalim/act';

const myContext = createContext('Default');

const Parent = () => {
  return h(myContext.Provider, { value: 'my-value', },
    h(Child)
  )
};

const Child = () => {
  const providedValue = useContext(myContext);

  return h('p', {},
    `I got the value ${providedValue} from one of my parents!`);
}

Errors

If a component throws an error (or anything, really), it either unmounts the whole app, or "suspends" the app up until a Boundary (a special kind of Element).

import { h, Boundary } from '@lukekaalim/act';

const BadComponent = () => {
  throw new Error("Oopsies")
}

const Parent = () => {
  const fallback = "Something went wrong!";

  return h(Boundary, { fallback }, h(BadComponent))
}

Rendering

Grab a Renderer (which turns Elements into actual HTML instances), and run it's render function:

import { render } from '@lukekaalim/act-web';
import { h } from '@lukekaalim/act';

const MyApp = () => {
  const onClick = () => {
    alert("Nothing");
  }

  return [
    h('h1', {}, `This is my application!`),
    h('button', { onClick } , 'this button shows you nothing')
  ]
}

render(h(MyApp), document.body);

Utilities

The core library also bundles a short amount of utilities:

Types