Run the passed callback function on any gamepad button update including touch and value.
import useButtonChange from 'react-ctrls/useButtonChange';
const MyComponent = () => {
useButtonChange((data) => {
console.log(data);
});
return <div>...</div>;
};
interface IGamepadEventData {
gamepad: Gamepad;
index: number;
value: number;
}
Refer to mappings to target buttons on various gamepads.