Using Rails-UJS in JS modules (Rails 6 with webpacker)

in my app/javascript/packs/application.js:

import Rails from '@rails/ujs';
Rails.start();

and then in whatever module, controller, component I’m writing:

import Rails from '@rails/ujs';

Leave a Comment