JSFiddle - React, Tailwind, and code Playground

HTML

<button onclick="start()">start</button>
<p id="slide" width="400"></p>

JavaScript

var Slider = function() {
		// Array of Content
		this.path = ["hello1", "hello2", "hello3"];
    this.currentIndex = 0;
};
Slider.prototype.nextSlide = function() {
  document.getElementById("slide").innerHTML = this.path[this.currentIndex]; 

  this.currentIndex++;
  if(this.currentIndex >= this.path.length){
    this.currentIndex = 0;
  }
};

function start() {
	var slider1 = new Slider();

	slider1.nextSlide();
  
  window.setInterval(function(){
    slider1.nextSlide();
  }, 2500);
}