0.0.1 • Published 5 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 totruesetFalse: () => void: Set the state tofalsetoggler: () => 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 ('')