const handleVisibleArray = () => {
const counter = visibleArray <= totalArrayLength ? visibleArray + 3 : 0;
setvisibleArray(counter);
};
My values go more than the total array length. If the array length is 11, then on every click it should increase by.
const handleVisibleArray = () => {
setvisibleArray(prevState => {
return ((prevState + 3) <= totalArrayLength ? (visibleArray + 3) : 0);
});
};