You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #1910 [Docs][Stimulus] use camelCase for target naming (Jibbarth)
This PR was merged into the 2.x branch.
Discussion
----------
[Docs][Stimulus] use camelCase for target naming
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| 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](https://stimulus.hotwired.dev/reference/targets#naming-conventions), 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.
Commits
-------
4867dd1 [Docs][Stimulus] use camelCase for target naming
0 commit comments