re: The neatest way to handle alert dialogs in React 🥰 VIEW POST


Hi there! Nice solution. It throws an error when you click in either cancelo or accept button of the dialog...

proxyConsole.js:64 Warning: Failed prop type: The prop children is marked as required in ForwardRef(DialogTitle), but its value is undefined.
in ForwardRef(DialogTitle) (created by WithStyles(ForwardRef(DialogTitle)))
in WithStyles(ForwardRef(DialogTitle)) (at ConfirmationDialog.tsx:34)
in div (created by ForwardRef(Paper))
in ForwardRef(Paper) (created by WithStyles(ForwardRef(Paper)))
in WithStyles(ForwardRef(Paper)) (created by ForwardRef(Dialog))
in div (created by Transition)
in Transition (created by ForwardRef(Fade))
in ForwardRef(Fade) (created by TrapFocus)
in TrapFocus (created by ForwardRef(Modal))
in div (created by ForwardRef(Modal))
in ForwardRef(Portal) (created by ForwardRef(Modal))
in ForwardRef(Modal) (created by ForwardRef(Dialog))
in ForwardRef(Dialog) (created by WithStyles(ForwardRef(Dialog)))....


Auto answering this.... changing this line solves the problem.

<DialogTitle id="alert-dialog-title">{title ? title : ""}</DialogTitle>
Code of Conduct Report abuse