Js

// app/js/app.js
// golazy:turbo
// golazy:stimulus
// app/js/controllers/counter_controller.js
import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  static targets = ["output"]
  static values = { count: { type: Number, default: 0 } }

  increment() {
    this.countValue += 1
    this.outputTarget.textContent = String(this.countValue)
  }
}
{{/* app/views/home/index.html.tpl */}}
<div data-controller="counter">
  <output data-counter-target="output">0</output>
  <button type="button" data-action="counter#increment">Increment</button>
</div>