Javascript
We use Hotwire as our Javascript solution.
Now Hotwire mainly contains two parts, Turbo
and Stimulus
Turbo
Turbo
contains four parts:
Turbo Drive
: accelerates links and form submissionsTurbo Frames
: decompose pages into independent contexts like HTMLiframe
Turbo Streams
: deliver page changes over WebSocket, SSE or in response to form submissions using just HTML and a set of CRUD-like actionsTurbo Native
: help build hybrid apps for iOS and Android.
You can check https://turbo.hotwired.dev/ to learn more.
We import Turbo in frontend/src/application/app.js
Stimulus
Stimulus is a JavaScript framework with modest ambitions. Unlike other front-end frameworks, Stimulus is designed to enhance static or server-rendered HTML—the “HTML you already have”—by connecting JavaScript objects to elements on the page using simple annotations.
We can:
- Use the classic dev frameworks such as Django, Rails to render HTML.
- Use
Stimulus
to attach JS to the DOM elements.
You can check https://stimulus.hotwired.dev/ to learn more.
tip
We have created some Stimulus controllers for you, and you can find them in frontend/src/controllers.