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-service-rx

v1.0.6

Published

Simple rxjs service to use with react through hooks

Downloads

2

Readme

react-service-rx

This is a simple library to keep the UI state through services instead of using the overhead of some other state management tools.

Installation

    npm i react-service-rx

Usage

First we create a service for a particular section of the UI. Lest say we want to have a react component that shows the score of a game. So, we first create a service with it's initial state like such:

    import {ServiceRx} from 'react-service-rx';

    export type Score = {
        home: number,
        visit: number
    }

    export const scoreService = new ServiceRx<Score>({home: 10, visit: 0});

We could also create the service as a class that extends ServiceRx in case that we want to add other methods or properties to the service.

The next step is using the custom react hook useService, the hook returns an array with the state and an update function that we can use to update the state of the service if needed.

    import {useService} from 'react-service-rx';
    import {scoreService, Score} from '../services/score.service';

    export function ScoreCard() {
        const [state, update] = useService<Score>(scoreService);

        const handleClick = () => {
            update({home: 0, visit: 0});
        }

        return (
        <div>
            home: {state.home}<br/>
            visit: {state.visit}<br/>
            <button onClick={handleClick}>Reset</button>
        </div>
        )
    }

This way we can divide the different parts of the state using separate services, each one scoped to it's purpose. So we could have one service that only handles error messages, modal states or any global UI state that we might need in the app and having all of these components subscribed to these services using the useService hook.