use-ctrl-enter
v1.0.4
Published
A custom [React Hook](https://reactjs.org/docs/hooks-overview.html) implement control+enter
Downloads
2
Maintainers
Readme
use-ctrl-enter
A custom React Hook implement control+enter
Usage
import React from 'react';
import useCtrlEnter from 'use-ctrl-enter';
const { useEffect } = React;
const App = () => {
const { ref, isCtrlEnter } = useCtrlEnter();
useEffect(() => {
if (isCtrlEnter) {
alert(ref.current.value);
}
}, [isCtrlEnter]);
return <textarea ref={ref} />;
};