fix: Save description when clicking outside

This commit is contained in:
Maksim Eltyshev
2024-10-31 14:56:11 +01:00
parent 369bee63b1
commit 02ed280e2d
5 changed files with 106 additions and 12 deletions
+14
View File
@@ -0,0 +1,14 @@
import { useCallback, useRef } from 'react';
export default (nestedRefName = 'ref') => {
const ref = useRef(null);
const handleRef = useCallback(
(element) => {
ref.current = element?.[nestedRefName].current;
},
[nestedRefName],
);
return [ref, handleRef];
};