DEV Community

Discussion on: Build a real-time Twitter clone in 10 mins with Rails and StimulusReflex

Collapse
 
gafemoyano profile image
Felipe Moyano

Hi Nate!

Thanks for the video. I've been meaning to try stimulus reflex for a while now and this video finally gave me the push to plug it into a project. I've been really liking it so far! The library in itself it's great, but honestly I thought Cable Ready was the most impressive part of it all. I just didn't know that it could make it so easy to broadcast changes to clients. I'd never really had any reason to dive into Action Cable, I guess it just seemed.. daunting. But Cable Ready just kind of works, which is great.
Thanks for your work!

On a side note, digging into Stimulus Reflex has made me a bit.. conflicted, about the way I handle some front end code. I recently discovered Alpine.js, and I've loved it so far. The declarative approach works better for me than toggling classes on Stimulus Controllers and I personally like just having the behavior in the HTML. And I wouldn't really know how to handle animations and transitions in Stimulus. But it does make me wonder how Alpine would fit in a Stimulus Reflex app? Maybe you could push 'hidden' content and toggle it with alpine.

I know the point of Stimulus Reflex is that you wont need to write as much javascript, but still... I feel that with Stimulus Reflex things just POP into the screen, which is OK most of the time, but sometimes you'd want to make it a bit smoother. For example adding a little fade in to a modal, or an opacity/fade-in transition when displaying dynamic content.

Anyway, just kind of thinking out loud. Thanks again for your work!

Collapse
 
mtomov profile image
Martin Tomov

Hi,

For Stimulus only transitions, take a look at cnpmjs.org/package/stimulus-reveal

Collapse
 
hopsoft profile image
Hopsoft

You're correct that CableReady really is the unsung hero of the demo. It provides the foundation for tools like StimulusReflex to be built on top of it... and it's capable of so much more.

I've never used Alpine.js before, but we have had some discussions in the Discord channel about allowing users to add some intentional latency to morph so they and do things like visual transitions etc..., so this is a feature others have asked for. I don't have a great answer for the best way to use Alpine.js in a StimulusReflex project other than to suggest some experimenting. I don't believe these tools are mutually exclusive, but figuring out how they can best work together will take some trial and error.