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

@keinguyen/react-fast-context

v1.0.4

Published

React Context without much rerendering

Readme

REACT FAST CONTEXT

Inspired of Jack Herrington Fast Context: https://github.com/jherr/fast-react-context

This small package will help projects run with Context without worring about performance and controlling big State Management like Redux.

And fully typescript support!

Installation:

Using npm:

$ npm i --save @keinguyen/react-fast-context

Why use this package?

  1. It's applying the subcribing method which will only trigger change on the component which is listening the changed value.
  2. Typescript support 100%.
  3. As a Context, this help splitting big components to smaller ones but can control the state value without considering about performance.

Requirement:

  • Node.js 16+
  • React.js 17.0.2+
  • Typescript 4.4.4+

Usage:

1. Create context

// context.ts
import { createFastContext } from "@keinguyen/react-fast-context";

interface State {
	keyA: number;
	keyB: string;
	keyC?: boolean;
}

const initialState: State = {
	keyA: 0,
	keyB: "something",
};

export const {
	Provider, // Context Provider
	useCommit, // Commit changes to the context
	useSelector, // Subcribe the value from the context
	useLazySelector, // Get the function that could get the value from the context by the time is executed
	createSelector, // Create a caching selector which help reducing complex computing during query
} = createFastContext(initialState);

2. Get and update values from Context

// index.tsx
import { Provider, useSelector, useCommit } from "./context";

function Component() {
	const commit = useCommit();
	const keyA = useSelector((store) => store.keyA); // fully typescript support

	const handleClick = () => {
		commit({ keyA: keyA + 1 });
		/*
		Or you can pass function into commit function to get the current store state
		You don't need to return all values in the context, just a part of them, it is smart enough to understand about overriding, not replace whole new store value.

		commit((store) => ({ keyA: store.keyA + 1 }))
		*/
	};

	return (
		<>
			Current value {keyA}
			<button onClick={handleClick}>
				Click me to increase value to {keyA + 1}
			</button>
		</>
	);
}

export default function Main() {
	return (
		<Provider>
			<Component />
		</Provider>
	);
}

3. Create selectors

// selectors.ts
import { createSelector } from "./context";

export const getComplexCalcKeyA = createSelector(
	[(store) => store.keyA],
	(keyA) => keyA * 15 + 1000 / 30,
);

export const getKeyBAndCalcKeyA = createSelector(
	[
		getComplexCalcKeyA,
		(store) => store.keyB,
	],
	(complexKeyA, keyB) => `${keyB} with calc value ${complexKeyA}`,
)


// index.tsx
import { getKeyBAndCalcKeyA } from "./selectors";

function AnotherComponent() {
	const complexValue = useSelector(getKeyBAndCalcKeyA);

	return (
		<>
			Complex value {complexValue}
		</>
	);
}