

<a target="_blank" rel="noopener noreferrer" href="https://vercel.com?utm_source=rooks&utm_campaign=oss"
We are currently only accepting contributions from verified contributors. If you wish to contribute, please open an issue first to discuss your proposed changes.
Get up and running in seconds:
npm install rooks
# or
yarn add rooks
# or
pnpm add rooks
Import any hook and start using it:
import { useDidMount, useCounter, useToggle } from "rooks";
function App() {
const { value, increment, decrement } = useCounter(0);
const [isOn, toggleIsOn] = useToggle(false);
useDidMount(() => {
console.log("Component mounted! 🎉");
});
return (
<h1>Count: {value}</h1>
<button onClick={increment}>Increment</button>
<button onClick={decrement}>Decrement</button>
<h2>Toggle is {isOn ? "ON" : "OFF"}</h2>
<button onClick={toggleIsOn}>Toggle</button>
);
}
📖 Browse all hooks • 🎮 Try in CodeSandbox
| 🎯 | Focused Each hook does one thing well | 📦 | Tree-shakeable Import only what you need |
| 🔄 | SSR Ready Works with Next.js, Remix, Gatsby | 🧪 | Well Tested 95%+ code coverage |
| 📚 | Documented Every hook has examples & demos | ⚡ | TypeScript First Full type safety out of the box |
| 🎨 | Modern Built for React 18+ with ESM | 🤝 | Community Driven 82 contributors and growing |
| useCounter Counter with increment/decrement | useToggle Toggle between values | useLocalstorageState useState with localStorage sync |
const { value, increment }
= useCounter(0)
|
const [on, toggle]
= useToggle()
|
const [user, setUser]
= useLocalstorageState('user')
|
| useKey Keyboard event handling | useOutsideClick Detect clicks outside element | useOnClickRef Click handler with ref |
| useDidMount componentDidMount equivalent | useWillUnmount componentWillUnmount equivalent | useDebounce Debounce any value |
isLocked is set to true.$ claude mcp add rooks \
-- python -m otcore.mcp_server <graph>