import { useRef, useCallback } from 'react';

const useDataValue = (callback) => {
    const ref = useRef();
    ref.current = callback;
    const action = useCallback((e) => {
        const value = e.currentTarget.getAttribute('data-value');
        ref.current && ref.current(value, e);
    }, []);
    return action;
};

export { useDataValue as u };
