"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useStateCycle = void 0;
const react_1 = require("react");
function useStateCycle(stateList, initialStateIndex = 0) {
    const [index, setIndex] = (0, react_1.useState)(initialStateIndex);
    return [
        stateList[index],
        () => setIndex(index => {
            if (index + 1 < stateList.length) {
                return index + 1;
            }
            else {
                return 0;
            }
        })
    ];
}
exports.useStateCycle = useStateCycle;
//# sourceMappingURL=use-state-cycle.js.map