MVP Debugger UI (#2888)

This commit is contained in:
Jonathan Dobson
2025-07-07 22:30:33 -04:00
committed by GitHub
parent d63053835f
commit acbdb15265
65 changed files with 2071 additions and 1022 deletions

View File

@@ -0,0 +1,17 @@
import { useEffect, useRef } from "react";
function useOnChange<T>(
value: T,
callback: (newValue: T, prevValue: T | undefined) => void,
) {
const prevValue = useRef<T>(value);
useEffect(() => {
if (prevValue.current !== undefined) {
callback(value, prevValue.current);
}
prevValue.current = value;
}, [value, callback]);
}
export { useOnChange };