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

sweet-react-tools

v0.2.0

Published

Simple, useful and efficient tools to streamline development with React, JSX, React Native & Expo

Readme

Sweet React Tools

npm license typescript

A library of practical & reusable React utilities designed to make working with children, props, and common React patterns simpler, safer, and more consistent.

⚠️ Work in Progress

Sweet React Tools is currently in its early stages.

The project is intentionally being built alongside real applications, with new utilities added only after proving useful in practice.

The current release focuses on a small set of foundational helpers for working with React children and props.

Overview ✨

Sweet React Tools focuses on making everyday React development a little more pleasant by providing small, composable helpers for common React tasks.

Current goals include:

  • reducing repetitive React boilerplate
  • safer handling of children
  • simpler props inspection
  • predictable, TypeScript-friendly APIs
  • excellent IntelliSense
  • small, focused utilities

Like the rest of the Sweet ecosystem, this library is application-driven.

New utilities are extracted from real applications rather than designed in isolation.

tl;dr: Small React helpers. Practical, predictable, reusable. ✨

Installation

npm install sweet-react-tools

Sweet React Tools is built on top of Sweet JS Tools, installed automatically as a dependency.

Contents

👶 Children Tools

Utilities for working with React children safely and consistently.

Current helpers include:

  • convert children into arrays: childrenToArray
  • generic child filtering: filterChildren
  • filter by runtime child type: filterChildrenByType
  • filter only React elements: filterElementChildren
  • remove non-rendering children: removeNullishChildren

Example usage

const elements = filterElementChildren(props.children);

const textChildren = filterChildrenByType(
    props.children,
    "string"
);

const renderableChildren = removeNullishChildren(
    props.children
);

🧩 Props Tools

Utilities for inspecting and working with React component props.

Current helpers include:

  • check whether props exist: hasProps
  • check for a children prop: hasChildren
  • check for renderable children: hasRenderableChildren
  • retrieve prop keys: getPropKeys
  • check for specific prop keys: hasPropKeys

Example usage

if (hasRenderableChildren(props)) {
    // ...
}

if (hasPropKeys(props, ["disabled", "variant"])) {
    // ...
}

const keys = getPropKeys(props);

Planned Next Steps

The following utilities are planned, but will only be added after being validated through real-world application development.

Children

  • mapChildren
  • mapElementChildren
  • findChild
  • onlyChild
  • countChildren
  • someChildren
  • everyChild
  • filterChildrenByProp
  • filterChildrenByPropValue

Elements

Element inspection utilities are currently on hold.

The original goal was to provide a friendlier API for inspecting React elements, but this area will be revisited after further real-world usage determines the most useful abstractions.

Future

Potential future areas include:

  • React hooks
  • Context helpers
  • Component composition
  • Element manipulation
  • Compound component helpers

As with every Sweet package, these features will only be extracted from repeated use in production applications.