Skip to content

Instantly share code, notes, and snippets.

View raphaelsetin's full-sized avatar
💭
Working on private repos, mainly in GitLab 😢

Raphael Setin raphaelsetin

💭
Working on private repos, mainly in GitLab 😢
View GitHub Profile
@raphaelsetin
raphaelsetin / detectPressedKeysReact.js
Created September 20, 2022 06:54
Detect Multiple Pressed Keys in React / JavaScript
import { useEffect, useState } from "react";
import Backdrop from '@mui/material/Backdrop';
export const Example = () => {
const [backdropOpen, setBackdropOpen] = useState(false);
useEffect(() => {
// Keys that need to be pressed at the same time in order for
// the 'backdropOpen' variable to be 'true'
const keysArr = ['ControlLeft', 'ShiftLeft', 'AltLeft'];