0.0.1 • Published 3 years ago
molohooks v0.0.1
Molohooks
only 2 hooks, mainly for my personal use
Hooks
useToggler
For boolean state
Params
defaultValue: boolean
: Default value for the state
Returns
value: boolean
: The value of the statesetTrue: () => void
: Set the state totrue
setFalse: () => void
: Set the state tofalse
toggler: () => void
: Toggle the state
useInputHandler
For controlled input handler
Params
defaultValue: string
: Default value for the state
Returns
value: boolean
: The value of the statehandleChange: (e: ChangeEvent<HTMLInputElement>) => void
: Handler for onChange event on input elementclearValue: () => void
: Set the value to an empty string (''
)