This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a code snippet living in a component | |
// source: https://stackoverflow.com/a/59843241/3600510 | |
const usePrevious = (value, initialValue) => { | |
const ref = useRef(initialValue); | |
useEffect(() => { | |
ref.current = value; | |
}); | |
return ref.current; | |
}; | |
const useEffectDebugger = (effectHook, dependencies, dependencyNames = []) => { |