toolbox: adds devtoolbox to easily manage debug components
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { ReactNode, useCallback, useRef } from 'react'
|
||||
import { ReactNode, useCallback, useRef } from "react";
|
||||
|
||||
export const useRefCallback = <T = ReactNode>() : [T | null, (arg: T) => void] => {
|
||||
export const useRefCallback = <T = ReactNode>(): [
|
||||
T | null,
|
||||
(arg: T) => void,
|
||||
] => {
|
||||
const ref = useRef<T | null>(null);
|
||||
const setRef = useCallback((val: T) => {
|
||||
console.log(val);
|
||||
if (ref.current) {
|
||||
// does something?
|
||||
}
|
||||
@@ -12,8 +14,8 @@ export const useRefCallback = <T = ReactNode>() : [T | null, (arg: T) => void] =
|
||||
// also does something?
|
||||
}
|
||||
|
||||
ref.current = val
|
||||
}, [])
|
||||
ref.current = val;
|
||||
}, []);
|
||||
|
||||
return [ref.current, setRef]
|
||||
}
|
||||
return [ref.current, setRef];
|
||||
};
|
||||
|
Reference in New Issue
Block a user