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

mkfolder-utils

v0.0.8

Published

**A collection of common React hooks and utilities for everyday development.**

Readme

MKfolder-utils

A collection of common React hooks and utilities for everyday development.

License npm version GitHub Repo


Features

  • Custom React Hooks: Ready-to-use hooks for common tasks.
  • TypeScript Support: Fully typed for better developer experience.
  • Lightweight: Minimal dependencies, focused on utility.
  • Future Plans: TSX components and utility scripts.

Installation

Install the package via npm:

npm install mkfolder-utils

Usage

  1. usePolling
    A hook that repeatedly executes a callback function at a specified interval. Useful for fetching real-time updates, monitoring changes, or refreshing data periodically.
import { usePolling } from 'mkfolder-utils';

const fetchData = async () => {
  const response = await fetch('https://api.example.com/data');
  const data = await response.json();
  console.log(data);
};

const MyComponent = () => {
  usePolling(fetchData, { interval: 5000, enabled: true });
  return <div>Polling every 5 seconds...</div>;
};
  1. useDebounce
    A hook that delays updating a value until after a specified period of inactivity. Ideal for optimizing performance in search inputs, API calls, or event handlers.
import { useState, useEffect } from 'react';
import { useDebounce } from 'mkfolder-utils';

const SearchComponent = () => {
  const [searchTerm, setSearchTerm] = useState('');
  const debouncedSearchTerm = useDebounce(searchTerm, 500);

  useEffect(() => {
    // Perform API call or expensive operation here
    console.log('Debounced search term:', debouncedSearchTerm);
  }, [debouncedSearchTerm]);

  return (
    <input
      type="text"
      value={searchTerm}
      onChange={(e) => setSearchTerm(e.target.value)}
      placeholder="Search..."
    />
  );
};
  1. useLocalStorage
    A hook that synchronizes a state variable with the browser's localStorage. Persists the value across page reloads and tabs, with automatic updates.
import { useLocalStorage } from 'mkfolder-utils';

const MyComponent = () => {
  //                                              key     default value
  const [name, setName] = useLocalStorage<string>('name', 'Alice');

  return (
    <div>
      <input
        type="text"
        value={name}
        onChange={(e) => setName(e.target.value)}
      />
      <p>Debounced value (saved to localStorage): {name}</p>
    </div>
  );
};
  1. useRetry A hook that automatically retries failed operations with configurable backoff strategies. Perfect for handling flaky API calls or unreliable network requests. Provides status tracking for UI feedback.

Modes:

  • Mode.CONSTANT - Fixed delay between retries (default)
  • Mode.EXPONENTIAL - Exponential backoff (delay doubles each time)
import { useRetry, Mode } from 'mkfolder-utils';

const MyComponent = () => {
  const { execute, status, error } = useRetry(
    async () => {
      const response = await fetch('/api/data');
      if (!response.ok) throw new Error('Failed to fetch');
      return response.json();
    },
    {
      initialInterval: 1000,      // Wait 1s between retries
      mode: Mode.EXPONENTIAL,     // Double delay each retry (1s, 2s, 4s...)
      maxRetries: 5               // Give up after 5 attempts
    }
  );

  return (
    <div>
      <button onClick={execute} disabled={status === 'fetching'}>
        Fetch Data
      </button>
      <div>{status === 'fetching' && Loading...}</div>
      <div>{status === 'error' && Error: {error?.message}}</div>
    </div>
  );
};

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the Apache License 2.0 – see the LICENSE for details.