Skip to main content
Home

Built and signed on GitHub Actions

Works with
This package works with Node.js, BrowsersIt is unknown whether this package works with Cloudflare Workers, Deno, Bun
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score100%
Published2 years ago (0.1.6)

More useful react hooks

React More Hooks

This is a collection of react hooks that are generally useful.

Usage

useConRef

Continually store a value into useRef.

Useful for passing callbacks into effects without reseting them.

const valueRef = useConRef(value);

useEffect(() => {
	setInterval(() => {
		console.log(valueRef.current);
	}, 1000);
}, [valueRef]);

useLooseRef

Create a react ref that can be "re-stated" to trigger effects and other hooks.

Useful for holding jwt credentails that may refresh or expire.

const authRef = useLooseRef(0);
// ...
authRef.refresh();

useRefCallback

Create a callback that doesn't ever change as a dependancy

Useful for passing callbacks into effects without reseting them

const callback = useRefCallback((a, b) => { return a + b });

useEffect(()=>{
	console.log(callback(1, 2));
}, [callback])
Built and signed on
GitHub Actions

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@smujdev/react-more-hooks

Import symbol

import * as react_more_hooks from "@smujdev/react-more-hooks";
or

Import directly with a jsr specifier

import * as react_more_hooks from "jsr:@smujdev/react-more-hooks";

Add Package

pnpm i jsr:@smujdev/react-more-hooks
or (using pnpm 10.8 or older)
pnpm dlx jsr add @smujdev/react-more-hooks

Import symbol

import * as react_more_hooks from "@smujdev/react-more-hooks";

Add Package

yarn add jsr:@smujdev/react-more-hooks
or (using Yarn 4.8 or older)
yarn dlx jsr add @smujdev/react-more-hooks

Import symbol

import * as react_more_hooks from "@smujdev/react-more-hooks";

Add Package

vlt install jsr:@smujdev/react-more-hooks

Import symbol

import * as react_more_hooks from "@smujdev/react-more-hooks";

Add Package

npx jsr add @smujdev/react-more-hooks

Import symbol

import * as react_more_hooks from "@smujdev/react-more-hooks";

Add Package

bunx jsr add @smujdev/react-more-hooks

Import symbol

import * as react_more_hooks from "@smujdev/react-more-hooks";