persona-community-5/.pnpm-store/v3/files/14/efa158d9758600b96db476e087c012e91ce47201e340272700e09e29d9cdd971d7946831758093f7597422e6ab0259a0001378d8f598a60188f306f086309a
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

24 lines
549 B
Plaintext

/**
* creates a Ref object with on change callback
* @param callback
* @returns {RefObject}
*
* @see {@link useCallbackRef}
* @see https://reactjs.org/docs/refs-and-the-dom.html#creating-refs
*/
export function createCallbackRef(callback) {
var current = null;
return {
get current() {
return current;
},
set current(value) {
var last = current;
if (last !== value) {
current = value;
callback(value, last);
}
},
};
}