I understand this is more a JS-related question than Stimulus-specific but can anyone explain to me why this works
connect() {
setTimeout(() => this.hideButton(), 1000)
}
while this fires HideButton
without delay?
connect() {
setTimeout(this.hideButton(), 1000)
}
I needed to set some delay and tried the second snippet without success. After searching for hints I came across Can't load child controller by target which pointed me in the right direction.
But now, I’d like to understand why.
Thanks