DEV Community

Discussion on: Building a horizontal slider with Stimulus and Tailwind CSS

Collapse
 
leastbad profile image
leastbad

That's the funny thing about a relatively small community: we each have a disproportionate ability to influence the direction "best practices" tend to fall. We've been doing our best to document these outcomes on betterstimulus.com/ for a few years now, but there's till lots we're figuring out in real time.

So yeah... I don't know if "Stimulus-y" means as much as "Rails-y" yet, because there's just been fewer eyeballs on the problem domain.

The litmus test I run with when trying to decide how to collect elements is: is there ambiguity such that targets enable an explicit control that wouldn't be possible to infer otherwise? Or, based on the nature of the controller and what's nested under it, is it redundant make-work?

In other words, a controller that is intended to live on a ul and wrangle li elements probably doesn't benefit from forcing developers to attach a target to each li.

Anything more arbitrary, well... yeah, that's what targets are for!

Thread Thread
 
davidcolbyatx profile image
David Colby

Yeah, I've gotten a ton of use out of betterstimulus.com since I've committed to Stimulus for most of my projects - you and the other folks there are a huge resource to the community.

That way of thinking about target usage seems pretty reasonable, thanks for sharing!