Avoid repetitive hook patterns, a source for making your own hooks.
export function useToggle(
defaultValue?: boolean,
): [boolean, () => void, Dispatch<SetStateAction<boolean>>] {
const [value, setValue] = useState(!!defaultValue);
const toggle = () => {
setValue((x) => !x);
};
// ...
};
Rehooks is an open-source project, to expand OSS communities.
Rehooks is written in TypeScript, ensuring type safety and maintainability throughout the codebase.
Rehooks offers a diverse variety of powerful hooks for different use cases, to efficiently implement functionality in components.
Crafted with SOLID principles, ensuring type-safety and maintainability throughout the codebase.