📚Cheatsheets

Cheatsheet collection for go, rust and javascript.

Listen Event on key Enter

Register on key down listener for Enter key.

useEffect(() => {
        const keyDownHandler = (e) => {
            if (e.code == "Enter") {
                fetchCodeSearch(val, filter)
            }
        };

        document.addEventListener("keydown", keyDownHandler);
        return () => {
            document.removeEventListener("keydown", keyDownHandler);
        };
    }, []);