import { useMemo } from 'react';
const useActiveGeo = ({
  features,
  tooltip
}) => {
  const countyShapesByCode = useMemo(() => {
    if (features.length < 1) {
      return {};
    }
    const res = {};
    features.forEach(feature => {
      res[feature.properties.code] = feature.properties.d;
    });
    return res;
  }, [features]);
  if (!tooltip || !tooltip.config.active) {
    return undefined;
  }
  const activeCode = tooltip.config.props.code;
  return countyShapesByCode[activeCode];
};
export default useActiveGeo;