/** * The "and this too" you type at 9am. * * The draft lives here rather than in the page: it is this dialog's business and * nothing else ever reads it. */ import { useState } from "react"; import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Stack, TextField, Typography, } from "@mui/material"; import { api } from "../../lib/api"; export default function AddTaskDialog({ open, onClose, onCreated, }: { open: boolean; onClose: () => void; onCreated: () => Promise; }) { const [draft, setDraft] = useState({ title: "", due_date: "" }); return ( New task setDraft({ ...draft, title: event.target.value })} /> setDraft({ ...draft, due_date: event.target.value })} /> Local tasks live only here, so they are the one kind you can delete. ); }