@smujdev/react-more-hooks@0.1.6Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
Works with
•JSR Score100%•This package works with Node.js, BrowsersIt is unknown whether this package works with Cloudflare Workers, Deno, Bun




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
Add Package
deno add jsr:@smujdev/react-more-hooks
Import symbol
import * as react_more_hooks from "@smujdev/react-more-hooks";
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
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
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";