import { useKeyRef, useMergeRefs } from "rooks";
export default function App() {
function vowelsEntered(e) {
console.log("[Demo 1] You typed a vowel");
}
function capitalVowelsEntered(e) {
console.log("[Demo 1] You typed a capital vowel");
}
const keyRef1 = useKeyRef(["a", "e", "i", "o", "u"], vowelsEntered);
const keyRef2 = useKeyRef(["A", "E", "I", "O", "U"], capitalVowelsEntered);
const inputRef = useMergeRefs(keyRef1, keyRef2);
return (
<>
<p>Press a,e,i,o,u in the input to trigger a console.log statement</p>
<input ref={inputRef} />
</>
);
}