Junior Track Roadmap

Hotwire: Turbo Drive & Frames

This course covers Turbo Drive and Turbo Frames as they run in a Rails app set up with the turbo-rails gem and one import map pin. It explains how Turbo Drive intercepts a link click, fetches the page and merges the head and body, including morph refreshes. It shows where the app turns prefetch and Turbo Drive off, and how tracked stylesheets, confirm dialogs and submit text work. It then covers Turbo Frames matched by id and a discussion frame that loads only when its dialog opens.

What you'll learn

  • ✓How Turbo Drive fetches a page and merges the head and body
  • ✓How morph refreshes work and how the turbo:morph event restores state
  • ✓When to turn off prefetch or Turbo Drive, as on OAuth buttons
  • ✓How data-turbo-track, data-turbo-confirm and data-turbo-submits-with behave
  • ✓How Turbo Frames and Turbo Streams match their target by id
  • ✓How to delay a frame's load until a dialog opens
Free preview · Lesson 1 2 min read

What Turbo Drive replaces

A plain server-rendered Rails app throws the whole page away on every click. The browser sends a request, the server sends back a full HTML document, and the browser discards the DOM and builds a new one. Stylesheets are parsed again, scripts run again, scroll position gone. This app doesn't do…

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...