UNPKG

@td-design/rn-hooks

Version:

从ahooks里面抽取的一些在rn项目里可以使用的hooks。提高开发效率

22 lines (19 loc) 494 B
import { useRef } from 'react'; var createUpdateEffect = function (hook) { return function (effect, deps) { var isMounted = useRef(false); // for react-refresh hook(function () { return function () { isMounted.current = false; }; }, []); hook(function () { if (!isMounted.current) { isMounted.current = true; } else { return effect(); } }, deps); }; }; export { createUpdateEffect };