UNPKG

@wojtekmaj/react-hooks

Version:

A collection of React Hooks.

8 lines (7 loc) 248 B
/** * Returns a flag and a function to toggle it. * * @param {boolean} defaultValue Default value * @returns {[boolean, () => void]} Flag and toggle function */ export default function useToggle(defaultValue?: boolean): [boolean, () => void];