1

May I know, can we achieve "Page-Specific Javascript" loading as mentioned in Organizing Javascript in Rails Application With Turbolinks article using the stimulusjs framework ?

Thanks.

    1 Answer 1

    1

    Yes, though it's more "component-specific".

    With Stimulus, you can add data-controller to any element, and at any time that elements is in the DOM, appropriate controller will be invoked. No need for $(document).ready or $(document).on("turbolinks:load") — everything happens automatically.

    You can read more in Stimulus Handbook.

      Start asking to get answers

      Find the answer to your question by asking.

      Ask question

      Explore related questions

      See similar questions with these tags.