Check out example codes for "rails 6 TypeError: $(...).tooltip is not a function". It will help you in understanding the concepts better.

Code Example 1

const { environment } = require('@rails/webpacker');
const customConfig = require('./custom');
const webpack = require('webpack');

environment.plugins.append(
  'Provide',
  new webpack.ProvidePlugin({
    $: 'jquery/src/jquery',
    jQuery: 'jquery/src/jquery',
    Popper: ['popper.js', 'default']
  })
);
environment.config.merge(customConfig);

module.exports = environment;

Learn ReactJs, React Native from akashmittal.com