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

@dreamfusion/pollen-react

v2.0.0

Published

React hooks for Pollen 2.0 reactive framework

Readme

@dreamfusion/pollen-react

React hooks for Pollen 2.0 reactive framework.

Installation

npm install @dreamfusion/pollen @dreamfusion/pollen-react

Quick Start

import { useCounter, useStore, useDebounce } from '@dreamfusion/pollen-react';

function Counter() {
  const { value, increment, decrement, reset } = useCounter(0, 1);
  
  return (
    <div>
      <h1>{value}</h1>
      <button onClick={increment}>+</button>
      <button onClick={decrement}>-</button>
      <button onClick={reset}>Reset</button>
    </div>
  );
}

function SearchInput() {
  const [query, setQuery] = useStore('');
  const debouncedQuery = useDebounce(query, 500);
  
  return (
    <div>
      <input 
        value={query} 
        onChange={(e) => setQuery(e.target.value)}
        placeholder="Search..."
      />
      <p>Searching for: {debouncedQuery}</p>
    </div>
  );
}

Hooks

usePollen

Create a pollinated object and manage its lifecycle with React.

import { usePollen, useNode } from '@dreamfusion/pollen-react';

function MyComponent() {
  const state = usePollen(() => ({}), {
    count: {
      type: 'number',
      get: () => 0,
      set: (v) => {}
    }
  });
  
  const count = useNode(state, 'count');
  
  return <div>Count: {count}</div>;
}

useNode

Subscribe to a single node value and re-render on changes.

const value = useNode(pollinated, 'nodeName');

useSetNode

Get a setter function for a node.

const setValue = useSetNode(pollinated, 'nodeName');
setValue(42);

useNodes

Subscribe to multiple nodes at once.

const { count, name, active } = useNodes(pollinated, ['count', 'name', 'active']);

useConnection

Create a connection between two pollinated objects.

useConnection(source, 'output', target, 'input', (value) => value * 2);

useFactory

Create a factory component and manage its lifecycle.

const counter = useFactory('logic.counter');

useCounter

Create a counter with increment, decrement, and reset.

const { value, increment, decrement, reset } = useCounter(0, 1);

useStore

Create a simple value store (like useState but with Pollen).

const [value, setValue] = useStore(initialValue);

useDebounce

Create a debounced value.

const debouncedValue = useDebounce(value, 300);

useThrottle

Create a throttled value.

const throttledValue = useThrottle(value, 1000);

useTimer

Create a countdown/stopwatch timer.

const { elapsed, remaining, running, complete, start, stop, reset } = useTimer(60000);

Complete Example

import React from 'react';
import { useCounter, useConnection, useFactory, useNode } from '@dreamfusion/pollen-react';

function App() {
  // Create two counters
  const counter1 = useFactory('logic.counter');
  const counter2 = useFactory('logic.counter');
  
  // Connect counter1 to counter2 (double the value)
  useConnection(counter1, 'value', counter2, 'value', (v) => v * 2);
  
  const value1 = useNode(counter1, 'value');
  const value2 = useNode(counter2, 'value');
  
  return (
    <div>
      <div>
        <h2>Counter 1: {value1}</h2>
        <button onClick={() => setNode(counter1, 'add', true)}>+</button>
      </div>
      
      <div>
        <h2>Counter 2 (2x): {value2}</h2>
      </div>
    </div>
  );
}

TypeScript Support

Full TypeScript support with type inference:

import { usePollen, useNode } from '@dreamfusion/pollen-react';

interface MyState {
  count: number;
  name: string;
}

const state = usePollen<MyState>(() => ({ count: 0, name: '' }), {
  count: { type: 'number', get: () => 0, set: (v) => {} },
  name: { type: 'string', get: () => '', set: (v) => {} }
});

const count = useNode<number>(state, 'count');
const name = useNode<string>(state, 'name');

License

MIT