Dev Helpers
← Back

Fresh draft per route

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 FreshDraftPerRoute({ children }: { children: ReactNode }) {
  const [draft, set] = useState("");
  return (
    <div>
      {children}
      <label>
        Page notes
        <textarea value={draft} onChange={(e) => set(e.target.value)} />
      </label>
    </div>
  );
}