Streamline Your React Hooks
A CLI to scaffold your react custom hooks, with a focus on performance, reusability, and type-safety.
export function useToggle(
defaultValue?: boolean,
): [boolean, () => void, Dispatch<SetStateAction<boolean>>] {
const [value, setValue] = useState(!!defaultValue);
const toggle = () => {
setValue((prev) => !prev);
};
// ...
};
useSessionStorage
○Product
useEventCallback
○Dropdown
useThrottle
○Command
useFocus
○Table
useFetch
○List
Compatibility
Compatible with React Frameworks
Rehooks has a wide compatibility around React Frameworks, including Next.js, Remix, Astro, etc.
Features
Crafted for Efficiency
I've created Rehooks to streamline the process of creating custom hooks, and get rid of heavy packages.
fix(cli): no args passed
feat(core): health checker
ref(docs): add missing props
Open-Source Codebase
Rehooks is an open-source project, licensed under Apache 2.0.
GET
/api/hooks/:title
Rehooks API
Rehooks provides a structured API that allows you to easily access the hooks you need.
Interact with the browser's session storage. This hook provides a simple and convenient way to store and retrieve data in session storage, with automatic serialization and deserialization of JSON data.
Debounces the value of a stateful value. This hook is useful for debouncing user input, such as typing in a search bar or a text field, to prevent rapid updates to the value.
Fetches data from an API. This hook provides a simple and convenient way to fetch data from an API, with automatic serialization and deserialization of JSON data.
Detects key presses in the browser. This hook is useful for detecting key presses, such as pressing the 'Enter' key or the 'Escape' key, and executing a callback function when the key is pressed.
Detects device changes in the browser. This hook is useful for detecting device changes, such as switching between mobile and desktop devices, and executing a callback function when the device changes.
Interact with the browser's session storage. This hook provides a simple and convenient way to store and retrieve data in session storage, with automatic serialization and deserialization of JSON data.
Debounces the value of a stateful value. This hook is useful for debouncing user input, such as typing in a search bar or a text field, to prevent rapid updates to the value.
Fetches data from an API. This hook provides a simple and convenient way to fetch data from an API, with automatic serialization and deserialization of JSON data.
Detects key presses in the browser. This hook is useful for detecting key presses, such as pressing the 'Enter' key or the 'Escape' key, and executing a callback function when the key is pressed.
Detects device changes in the browser. This hook is useful for detecting device changes, such as switching between mobile and desktop devices, and executing a callback function when the device changes.
Interact with the browser's session storage. This hook provides a simple and convenient way to store and retrieve data in session storage, with automatic serialization and deserialization of JSON data.
Debounces the value of a stateful value. This hook is useful for debouncing user input, such as typing in a search bar or a text field, to prevent rapid updates to the value.
Fetches data from an API. This hook provides a simple and convenient way to fetch data from an API, with automatic serialization and deserialization of JSON data.
Detects key presses in the browser. This hook is useful for detecting key presses, such as pressing the 'Enter' key or the 'Escape' key, and executing a callback function when the key is pressed.
Detects device changes in the browser. This hook is useful for detecting device changes, such as switching between mobile and desktop devices, and executing a callback function when the device changes.
Interact with the browser's session storage. This hook provides a simple and convenient way to store and retrieve data in session storage, with automatic serialization and deserialization of JSON data.
Debounces the value of a stateful value. This hook is useful for debouncing user input, such as typing in a search bar or a text field, to prevent rapid updates to the value.
Fetches data from an API. This hook provides a simple and convenient way to fetch data from an API, with automatic serialization and deserialization of JSON data.
Detects key presses in the browser. This hook is useful for detecting key presses, such as pressing the 'Enter' key or the 'Escape' key, and executing a callback function when the key is pressed.
Detects device changes in the browser. This hook is useful for detecting device changes, such as switching between mobile and desktop devices, and executing a callback function when the device changes.
Variety of Hooks
Rehooks offers a diverse variety of powerful hooks for different use cases, to efficiently implement functionality in components.
Performant & Reusability
Crafted with SOLID principles, ensuring type-safety and maintainability throughout the codebase.