provides an experimental turbo mode that enables SPA-like navigation.
You can see it in action in this site!
However, since it's very lightweight, it's compatible with the standard lifecycle of any of the supported frameworks, and it will progressively enhance the site, you can use it whenever a snappy navigation is preferrable.
script type="module"execute once
- For islands, use the lifecycle of each component as usual (
- In client scripts, use the
onLoadcallback for effects that should run on every page load
- Code outside components or callbacks won't run on each page navigation
- Add the
onceattribute to non-module scripts that should only execute once
It's possible to avoid unmounting islands that don't change from one page navigation to the other, making them automatically "permanent" (in the
@hotwired/turboterminology) without any intervention from the user.
That would allow persistent components typically found in SPAs like shopping carts to work seamlessly.