Menu
CoddyTech

Parent and Child Outlets

Part of the Routing and State section of Coddy's Vue journey. Lesson 21 of 55.

Nested routes express a layout containing another routed view. The root outlet renders the parent component, and the parent includes its own outlet for the child. In this example, the account shell stays mounted while its settings page is selected.

{path:'/account',component:AccountLayout,children:[
 {path:'settings',component:Settings}
]}
// AccountLayout template:
// <header>Account</header><RouterView />

A second outlet is meaningful because it occupies the next depth of matched route records. The parent can own shared controls or local state used across its child pages. Navigating to a completely different parent can unmount that layout and reset its local refs.

challenge icon

Challenge

Medium

Build the nested studio route. The parent /studio renders Studio.vue, whose inner RouterView displays child routes rooms and schedule at /studio/rooms and /studio/schedule. Keep the parent heading Studio workspace and its visit counter visible while switching children.

Keep the supplied route readout and bootstrap files.

Try it yourself

<!doctype html><html><head><meta charset="UTF-8"><title>Routing practice</title></head><body><div id="app"></div><script type="module" src="./main.js"></script></body></html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Routing and State