Skip to main content
InterviewHubPRO
Section Overview
Q15

Question 15 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

30%
Astro Islands & SSR (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

How do you persist state across page navigations with `transition:persist`?

senior LevelCode ExampleRoutingSystem Design

In Simple Words: When navigating between pages with View Transitions, all DOM elements are replaced. Adding transition:persist tells Astro to keep that specific DOM node alive across navigations:

astro
<aside transition:persist="sidebar">
  <VideoPlayer src="tutorial.mp4" autoplay />
</aside>

The video continues playing uninterrupted without pausing or resetting while the user navigates through different pages!