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

@naderikladious/react-flow

v1.0.1

Published

Declarative control-flow primitives for React (Condition/If/Else, For/ForEach, Batch) with TypeScript types.

Readme

Utilities for declarative control-flow primitives in React, written in TypeScript and packaged for ESM/CJS consumers.

Motivation

  • Keep conditional and iterative UI logic readable without custom hooks per component.
  • Provide type-safe, render-prop based building blocks (Flow.Condition, Flow.If, Flow.ForEach, etc.).
  • Ship tree-shakeable named exports for both bundlers and Node targets.

Demo preview (GIF):

Installation

npm install @naderikladious/react-flow

If working from this repo locally, install and build the library first:

npm install
npm run build

To explore the Vite example app:

cd example
npm install
npm run dev
# For GitHub Pages build: GITHUB_PAGES=true npm run build

API

Preferred namespace is Flow (with ReactFlow available as an alias).

  • Flow.Condition — provides a boolean value to descendants.
  • Flow.AsyncCondition — resolves a boolean asynchronously and provides it to descendants.
  • Flow.If — renders children when the condition is true (prop overrides context).
  • Flow.Else — renders children when the condition is false (prop overrides context).
  • Flow.Unless — renders children when the condition is false (prop overrides context).
  • Flow.ForEach<T> — iterates an array with an optional keyExtractor and render-function children (item, index) => ReactNode.
  • Flow.For — iterates count times with optional start and step, render-function children (index) => ReactNode.
  • Flow.Batch<T> — groups items into chunks of batchSize and renders (batch, batchIndex) => ReactNode using Flow.ForEach under the hood.
  • Flow.Switch / Flow.Case / Flow.Default — declarative branching on a single value.
  • useFlowCondition — hook to read the nearest Flow.Condition value (throws if missing).

All components are also available as named exports (tree-shakeable) in addition to the namespace object.

Examples

Basic conditionals:

<Flow.Condition value={isEnabled}>
  <Flow.If>
    <div>Enabled</div>
  </Flow.If>
  <Flow.Else>
    <div>Disabled</div>
</Flow.Else>
</Flow.Condition>

Lists and batches:

<Flow.ForEach items={items} keyExtractor={(item) => item.id}>
  {(item) => <div>{item.name}</div>}
</Flow.ForEach>

<Flow.Batch items={products} batchSize={3}>
  {(batch, i) => (
    <section>
      <h3>Batch {i + 1}</h3>
      {batch.map((product) => (
        <div key={product.id}>{product.title}</div>
      ))}
    </section>
  )}
</Flow.Batch>

Numeric loops:

<Flow.For count={5} start={1}>
  {(index) => <span key={index}>{index}</span>}
</Flow.For>

Scripts

  • npm run build — bundle to dist/ (CJS, ESM, and .d.ts).
  • npm run clean — clear and recreate dist/.
  • npm run lint — placeholder.

Project structure

  • src/ — library source.
  • dist/ — build output (CJS, ESM, types).
  • example/ — Vite app consuming the local package via file:...