amis-rpc-design/node_modules/antd/es/typography/hooks/useUpdatedEffect.js
2023-10-07 19:42:30 +08:00

13 lines
363 B
JavaScript

import * as React from 'react';
/** Similar with `useEffect` but only trigger after mounted */
const useUpdatedEffect = (callback, conditions) => {
const mountRef = React.useRef(false);
React.useEffect(() => {
if (mountRef.current) {
callback();
} else {
mountRef.current = true;
}
}, conditions);
};
export default useUpdatedEffect;