import { useRecoilValue } from 'recoil';
import get from 'lodash/get';
import useRegisterTimestamp from '../useRegisterTimestamp';
const useTimestampedData = function useTimestampedData(atom) {
  const data = useRecoilValue(atom);
  useRegisterTimestamp(get(data, 'source.metadata.lastUpdated', undefined));
  return get(data, 'data', undefined);
};
export default useTimestampedData;