0.0.1 • Published 3 years ago

molohooks v0.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
3 years ago

Molohooks

only 2 hooks, mainly for my personal use

Hooks

useToggler

For boolean state

Params

  1. defaultValue: boolean : Default value for the state

Returns

  1. value: boolean : The value of the state
  2. setTrue: () => void : Set the state to true
  3. setFalse: () => void : Set the state to false
  4. toggler: () => void : Toggle the state

useInputHandler

For controlled input handler

Params

  1. defaultValue: string : Default value for the state

Returns

  1. value: boolean : The value of the state
  2. handleChange: (e: ChangeEvent<HTMLInputElement>) => void : Handler for onChange event on input element
  3. clearValue: () => void : Set the value to an empty string ('')