import { Controller } from "@hotwired/stimulus"; export default class extends Controller { static targets = ["hello"]; connect() { console.log( "Hello once from the controller !", this.element, this.helloTargets ); } sayHi() { const ways_to_say_hello = ["Hello", "Hi", "Good Morning", "G'day"]; const index = Math.floor(Math.random() * ways_to_say_hello.length); this.helloTarget.innerText = ways_to_say_hello[index]; } }