Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return acc;
}
return [...acc, index];
}, [] as Array);
const enabledCurrentIndex = enabledIndexes.indexOf(selected!);
switch (e.keyCode) {
case keyMap.ArrowRight:
setSelected(
enabledIndexes[(enabledCurrentIndex + 1) % enabledIndexes.length],
);
break;
case keyMap.ArrowLeft:
setSelected(
enabledIndexes[
(enabledCurrentIndex - 1 + enabledIndexes.length) %
enabledIndexes.length
],
);
break;
}
}