I got lost in Ajax while creating a portfolio, so I'll leave this article for myself in the future.
Install jQuery library
$ yarn add [email protected]
Webpack environment editing
config/webpack/environment.js
const { environment } = require('@rails/webpacker')
#Add the following
const webpack = require('webpack')
environment.plugins.prepend('Provide',
  new webpack.ProvidePlugin({
    $: 'jquery/src/jquery',
    jQuery: 'jquery/src/jquery'
  })
)
#So far
module.exports = environment
Added to application.js
app/javascript/packs/application.js
require("jquery")
In order for Ajax to start even if javascript is disabled on the browser side
config/application.rb
module "app name"
  class Application < Rails::Application
    .
    .
    .
    #Add this!
    config.action_view.embed_authenticity_token_in_remote_forms = true
  end
All you have to do is write it down! !!