0.3.1 • Published 2 years ago

react-ready-hooks v0.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-ready-hooks

License: MIT npm

Install

yarn add react-ready-hooks

Hooks

  • useToggle Hook for handling boolean state.
  • useTimeout Hook for executing function after some delay
  • useUpdateEffect Hook for executing function only when their dependencies gets change

useToggle

const [value, toggleValue] = useToggle(false);

Methods:

  • toggleValue() - allow you to toggle state and you can also pass boolean value to set state.

Properties:

  • value - the current state

useTimeout

const { clear, reset } = useTimeout(() => {}, 1000);

This hook accept two parameter -> function to be execute and delay in milli second.

Methods:

  • clear() - allow you to clear timeout.
  • reset() - allow you to reset timeout.

useUpdateEffect

const [count, setCount] = useState(100);
useUpdateEffect(() => alert(count), [count]);

This hook accept two parameter -> function to be execute and dependencies array.

0.3.1

2 years ago

0.3.0

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago