KeyboardEvent.code vs keydown
-Represents a physical key on a keyboard vs the UTF-8 generated
KeyboardEvent.code vs
useEffect(() => {
document.addEventListener("keydown", handleKeyboard)
return () => {
document.removeEventListener("keydown", handleKeybaord)
}
}, [handleKeyboard])Looping Backwards is faster Only by a margin
New Date
{new Date(props.prop).toLocaleTimeString({hour: "numeric", minute: "numeric"})}Set Interval
setInterval(() => {setState(prev => prev), 1000})