You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
388 B
17 lines
388 B
import * as React from 'react';
|
|
import { useLayoutEffect } from './useLayoutEffect';
|
|
/**
|
|
* Work as `componentDidUpdate`
|
|
*/
|
|
|
|
export default function useUpdateEffect(callback, condition) {
|
|
var initRef = React.useRef(false);
|
|
useLayoutEffect(function () {
|
|
if (!initRef.current) {
|
|
initRef.current = true;
|
|
return undefined;
|
|
}
|
|
|
|
return callback();
|
|
}, condition);
|
|
} |