Skip to content

[Docs][Stimulus] use camelCase for target naming #1910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

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
2 checks passed
@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