layout-wrapper-components

Create React layout wrappers with auth guards and Outlet-based nested routes.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/wonkpentink/agent-skills-fe --skill layout-wrapper-components
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: layout-wrapper-components
Source: https://github.com/wonkpentink/agent-skills-fe/tree/main/skills/layout-wrapper-components
Command: npx skills add https://github.com/wonkpentink/agent-skills-fe --skill layout-wrapper-components

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Layout scaffolding for React apps often leads to repetitive boilerplate when implementing authenticated and public routes. This Skill provides reusable PrivateLayout and PublicLayout patterns with standardized auth checks, nested routing, and responsive structure suitable for dashboards and public portals.

Core Features & Use Cases

  • PrivateLayout: authentication guards, token decryption, conditional sidebar, and nested routes for protected areas.
  • PublicLayout: lightweight layout with consistent structure for public pages.
  • Route configuration: separate layouts for different access levels in router configuration.

Quick Start

Create PrivateLayout.tsx and PublicLayout.tsx under src/layout, wire them into your router, and render nested routes with Outlet.

Frequently Asked Questions about layout-wrapper-components

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create layout wrappers for protected and public routes in React Router?

To create layout wrappers for protected and public routes, build reusable PrivateLayout and PublicLayout components that render nested routes using Outlet, with token-based authentication checks applied as route guards in your router configuration.

What is the best way to structure authentication guards and conditional sidebars in a React admin panel?

The best way to structure authentication guards and conditional sidebars is using a PrivateLayout wrapper that decrypts tokens, verifies access, and renders nested routes with a responsive sidebar for your admin panel or CRM.

How do I configure nested routes with separate layouts for different access levels?

To configure nested routes with separate layouts, wire PrivateLayout and PublicLayout into your React Router configuration, rendering child routes through the Outlet component to enforce access levels across protected and public portals.

Does this layout wrapper pattern work with React Router v6?

Yes, this layout wrapper pattern works with React Router v6+ by leveraging the Outlet component for nested route rendering, applying standardized token checks, and scaffolding consistent layout structures for both public and private pages.

Why do I need a separate layout wrapper for public pages instead of sharing one?

You need a separate PublicLayout wrapper because public pages require a lightweight, consistent structure without authentication guards or conditional sidebars, preventing repetitive boilerplate when scaffolding public portals versus protected dashboard areas.