import $ from 'jquery'; class #component# { constructor({ el }) { this.root = $(el); } cache = {}; initCache() { /* Initialize selector cache here */ /** * Use "this.root" to find elements within current component * Example: * this.cache.$submitBtn = this.root.find('.js-submit-btn'); */ } bindEvents() { /* Bind jQuery events here */ /** * Example: * const { $submitBtn } = this.cache; * $submitBtn.on('click', () => { ... }); */ } init() { /* Mandatory method */ this.initCache(); this.bindEvents(); } } export default #component#;