✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.
Reduce conditions to one line
cihat886437985d83
diff --git a/src/hooks/useKeyPress.tsx b/src/hooks/useKeyPress.tsxindex a3e5c77a..6687a843 100644--- a/src/hooks/useKeyPress.tsx+++ b/src/hooks/useKeyPress.tsx@@ -4,14 +4,10 @@ const useKeyPress = (targetKey) => {const [keyPressed, setKeyPressed] = React.useState(false);function downHandler({ key }) {- if (key === targetKey) {- setKeyPressed(true);- }+ if (key === targetKey) setKeyPressed(true);}const upHandler = ({ key }) => {- if (key === targetKey) {- setKeyPressed(false);- }+ if (key === targetKey) setKeyPressed(false);};React.useEffect(() => {window.addEventListener("keydown", downHandler);