Installation
How to install and use ReactUseKit hooks and helpers in your project
CLI Installation
Use the shadcn CLI to quickly install hooks and helpers
pnpm dlx shadcn@latest add https://reactusekit.dev/r/[hooks/helper-name].json
Copy Paste
- Browse to the hook or helper documentation page
- Copy the source code
- Create a new file in your project:
- Hooks:
src/hooks/[hook-name].ts
- Helpers:
src/lib/[helper-name].ts
- Hooks:
- Paste the code and save
Usage
Hooks
import { useBoolean } from "@/hooks/use-boolean";
function MyComponent() {
const { value, toggle } = useBoolean(false);
return <button onClick={toggle}>{value ? "ON" : "OFF"}</button>;
}
Helpers
import { capitalize } from "@/lib/capitalize";
function Example() {
return <h1>{capitalize("hello world")}</h1>;
}