Streamline Your React Hooks

Avoid repetitive hook patterns, a source for making your own hooks.

src > hooks > useToggle
export function useToggle(
  defaultValue?: boolean,
): [boolean, () => void, Dispatch<SetStateAction<boolean>>] {
  const [value, setValue] = useState(!!defaultValue);

  const toggle = () => {
    setValue((x) => !x);
  };

  // ...
};
useSessionStorage
Product
useEventCallback
Dropdown
useThrottle
Command
useFocus
Table
useFetch
List

Features

Crafted for Efficiency

I've created Rehooks to streamline the process of creating custom hooks, and get rid of heavy packages.

Open-Source Codebase

Rehooks is an open-source project, to expand OSS communities.

<T><T><T>

TypeScript Support

Rehooks is written in TypeScript, ensuring type safety and maintainability throughout the codebase.

useSessionStorage
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.
useDebounceValue
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.
useFetch
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.
useKeyPress
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.
useDevice
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.
useSessionStorage
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.
useDebounceValue
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.
useFetch
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.
useKeyPress
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.
useDevice
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.
useSessionStorage
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.
useDebounceValue
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.
useFetch
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.
useKeyPress
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.
useDevice
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.
useSessionStorage
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.
useDebounceValue
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.
useFetch
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.
useKeyPress
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.
useDevice
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.