I was browsing your repo looking at the useGamepad implementation. I saw that the button inputs were being stringified and a mis-use of the useEffect. It's probably early to look at optimizations, but I thought I'd submit this for review.
updated controller state to bitmask
Less resources to check if the int changes vs a json string compare
updated gamepadInfo to useRef
Since useState is asynchronous, state isn't always updated by next interval tick
force re-render only when inputs are changed
Updated controller refresh to once per frame
removed dependency from useEffect initializer
the former obj in the dep array would run the useEffect on every re-render
I was browsing your repo looking at the useGamepad implementation. I saw that the button inputs were being stringified and a mis-use of the useEffect. It's probably early to look at optimizations, but I thought I'd submit this for review.