tinky / useStdin
useStdin():
StdinProps
useStdin is a React hook that exposes the stdin stream and related utilities.
The stdin context containing the stdin stream, setRawMode function,
and isRawModeSupported flag.
import { useStdin } from "tinky";
function InputComponent() {
const { stdin, setRawMode, isRawModeSupported } = useStdin();
useEffect(() => {
if (isRawModeSupported) {
setRawMode(true);
return () => setRawMode(false);
}
}, [setRawMode, isRawModeSupported]);
return <Text>Listening for input...</Text>;
}