New source found from dndbeyond.com

This commit is contained in:
2026-07-08 01:00:09 -07:00
parent 9a983a6d7b
commit dcefa0d2f2
2865 changed files with 222467 additions and 49053 deletions
@@ -0,0 +1,32 @@
import React, {
DependencyList,
EffectCallback,
useEffect,
useRef,
} from "react";
/**
* React.useEffect, except that it never runs on mount.
* This is emulating the componentDidUpdate lifecycle function.
*/
export const useEffectExceptOnMount = (
effect: EffectCallback,
dependencies?: DependencyList
): void => {
const mounted = useRef(false);
useEffect(() => {
if (mounted.current) {
const unmount = effect();
return () => unmount && unmount();
} else {
mounted.current = true;
}
}, dependencies);
//Reset on unmount for the next mount.
useEffect(() => {
return () => {
mounted.current = false;
};
}, []);
};