npm i addactiveclass
then...
import { addactiveclass } from addactiveclass;
addactiveclass({
arrayClass: 'navButtons' // the common class of all buttons,
activeClass: 'active' // the class name to add to the selected
index: 2 // the selected button hover or clicked
})