After diving in many rabbit holes trying to figure out why my JS was not loading after using rails link helper link_to
... I think I have the answer.
Rails guide tells us one thing however, this seems to be working for me
document.addEventListener("turbo:load", function () {
yourFunction();
});
Hope this helps you!
demo: https://rails-7-esbuild.herokuapp.com/
repo: https://github.com/jocvegar/rails_7_esbuild
Top comments (1)
Thank you for this. Helped a lot!