<div data-controller="loader"
data-loader-url-value="/messages">
</div>
// controllers/loader_controller.js
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static values = {
url: String
}
connect() {
fetch(this.urlValue).then(/* … */)
}
}