react-use-that
<br />
react-use-that
Basic and powful react hooks
Install
npm i react-use-that
Usages
useCallback
"useCallback Hooks" same as react/useCallback, more powerful than react/usecallback, the reference of useCallback's return value is unchanged.
{ const cb = // do something with cb}
useCurrent
"useCurrent Hooks" can get the value of the latest render function execution context.
{ const getCount = ... // can use getCount in other callback }
useState
"useState Hooks" can perform the callback in didUpdate caused by the corresponding setState.
{ const count setCount = ... // place setCount in other callback }
useMount
"useMount Hooks" can perform the callback defined by the latest render function context before didMount or willUnmount. The parameter callback is only executed once in didMount, you don't need to care about redundant execution due to dependency changes.
{ }