Skip to content

Conversation

Jibbarth
Copy link
Contributor

Q A
Bug fix? no
New feature? no
Issues Fix #...
License MIT

Hello!

I had some trouble following the doc for use stimulus_target and how to use them inside my stimulus controller.

As we can see on the stimulus target doc, the value of target should be in camelCase as it's mapped in property in the controller.

IE

<div data-my-controller-target="myElement">
import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  static targets = [ "myElement"]
  // …
  foo() {
	this.myElementTarget.innerHTML = "...";
  }
}

So in this PR, I changed examples for stimulus_target usage.

@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Jun 11, 2024
@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Jun 11, 2024
@kbond
Copy link
Member

kbond commented Jun 11, 2024

Thank you Jibé.

@kbond kbond merged commit 5099e8b into symfony:2.x Jun 11, 2024
@Jibbarth Jibbarth deleted the feature/docs-stimulus-target-naming-convention branch June 11, 2024 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants