vituarvom / react-smart-utils

A simple, smart hooks and utility functions to make development easier
https://www.npmjs.com/package/react-smart-utils
13 stars 34 forks source link

Implement useToggle hook #12

Open bharat-dussa opened 2 months ago

bharat-dussa commented 2 months ago

A simple hook to toggle a boolean value between true and false. Useful for toggling states like modals, dropdowns, or toggling any component's visibility.

Parameters:

initialValue: boolean – The initial value to toggle.

Returns:

value: boolean – The current boolean value.
toggle: () => void – A function to toggle the value between true and false.
const [isToggled, toggle] = useToggle(false);

Goal: Implement a hook that toggles a boolean value and returns the state and toggle function.

Laxman8261 commented 2 months ago

i would like to work on this issue pls assign me @bharat-dussa