Having trouble with keydown events in REACT

Having trouble with keydown events in REACT
0

#1

Here is the link to my codepen https://codepen.io/zootechdrum/pen/PBVYNL?editors=0010

I can’t seem to change the id when I do a key press. How can I change the I.D it is referencing on keypress.
The only way I can get “same” to print to the console is by first clicking any of the 3 buttons first and then pressing that same key on the keyboard. However if I try to print “same” without clicking on that button first, it does not work.


#2

I figured it out! Thank you anyways!