Commit 5099e8b
committed
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 naming1 file changed
+7
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
341 | | - | |
| 340 | + | |
| 341 | + | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
345 | | - | |
| 344 | + | |
| 345 | + | |
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
352 | | - | |
| 352 | + | |
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
| 357 | + | |
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | | - | |
| 365 | + | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| |||
0 commit comments