Dev Helpers
← Back

Remounting welcome tip

Place this file at app/studio/template.tsx in an App Router project.

Open this example in the interactive library

Source code

"use client";

// app/studio/template.tsx

import { useState } from "react";

import type { ReactNode } from "react";

export default function RemountingWelcomeTip({ children }: { children: ReactNode }) {
  const [shown, set] = useState(true);
  return (
    <>
      {shown && (
        <aside>
          Use the chapter links to explore.{" "}
          <button onClick={() => set(false)}>Dismiss</button>
        </aside>
      )}
      {children}
    </>
  );
}