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

param-medic

v0.2.0

Published

**Param-medic** helps you manage your state in React SPAs using URL parameters and provides a hook for easy retrieval, updating, and deletion.

Downloads

23

Readme

Param Medic · NPM Version NPM Type Definitions NPM Downloads

Param-medic helps you manage your state in React SPAs using URL parameters and provides a hook for easy retrieval, updating, and deletion.

Features

  • useParams – Retrieve, update, and reset state via URL parameters.
  • ParamContextProvider – Define expected keys to filter URL parameters.
  • Seamless State Syncing – Keeps state in sync with browser navigation (Back/Forward).

Usage

The useParams hook returns an array with three values:

  1. Params – The current state derived from URL parameters.
  2. setParams – Updates the state. Accepts a function and an optional { replace: boolean } object to determine if the browser history should be replaced or pushed.
  3. resetParams – Resets the state to its initial value.

Note: If no initial state is provided, params may be undefined. Ensure your logic accounts for this.

Example

A URL of /?count=5 correctly displays count: 5 and overrides the initial value. If / is visited without parameters, it falls back to the initial state { count: 1 }. With replace: true, the counter decreases when clicking the back button.

import { useParams } from 'param-medic';

function App() {
  const [params, setParams] = useParams < { count: number } > { count: 1 };

  return (
    <button
      onClick={() =>
        setParams((prev) => ({ ...prev, count: prev.count + 1 }), {
          replace: false,
        })
      }
    >
      Count is {params.count}
    </button>
  );
}

export default App;

Context-Based Parameter Filtering

Wrap components inside ParamContextProvider to specify which URL parameters should be managed.

  • Only listed keys are used.
  • Other URL parameters remain unchanged until an update occurs.
  • On updates, only listed keys persist, and unlisted ones are removed.

Example

Wrap your components into the ParamContextProvider to specify the keys which you expect. The context ensures that only these keys are used, while other parameters are ignored and removed from the url during an update.

import { ParamContextProvider } from 'param-medic';

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <ParamContextProvider keys={['count']}>
      <App />
    </ParamContextProvider>
  </StrictMode>
);

If you want to prevent certain values from appearing as plain text in the URL, you can define a key as an object and add hide: true along with a secret. The value will be encrypted before being stored in the URL and decrypted when accessed.

Note: This encryption is only for obscuring values from plain sight and should not be considered a secure encryption method.

<ParamContextProvider
  keys={[
    'count',
    { name: 'search', hide: true, secret: import.meta.env.VITE_SOME_KEY },
  ]}
>
  <App />
</ParamContextProvider>

You can add and delete keys dynamically using the useParamContext hook.

Contributing

Create a branch on your fork, add commits to your fork, and open a pull request from your fork to this repository.

Changelog

To check full changelog click here

License

MIT