import { useCallback } from 'react';
import useKey from 'react-use/lib/useKey';

var useRegistInputEnterEvent = function useRegistInputEnterEvent(inputRef, onPressEnter) {
  var keyFilter = useCallback(function (event) {
    return event.key === 'Enter' && event.target === inputRef.current;
  }, [inputRef]);
  useKey(keyFilter, onPressEnter, undefined, [onPressEnter]);
};

export default useRegistInputEnterEvent;

