In React, onButtonClick method updates state on currentIndex properly, but not on the currentText. If you check out the two console logs, you\'ll see that currentText lags b