Welchen besser können Sie besser tun oder gibt es bessere Möglichkeiten, dies zu tun?
1. > < /p>
Code: Select all
{notesModalState.open && (
handleNotesModal({ open: false})}
/>
)}
Code: Select all
handleNotesModal({ open: false})}
/>
Code: Select all
const NotesModal = ({
isOpen = false,
onClose = () => {},
onSuccess = () => {},
}: NotesModalProps) => {
const notesData = data //retrieve from something
const [note, setNote] = useState(notesData?.notes || "");
// useEffect(() => {
// setNote(notesData || "");
// }, [notesData]);
const saveNote = async () => {
// call API
};
const handleClose = () => {
onClose();
};
const recipientName = notesData?.fullName
return (
Note for {recipientName}
setNote(e.target.value)}
fullWidth
/>
Cancel
Submit
);
};