如何解决SweetAlert2-对象作为React子对象无效
我正在尝试在我的react应用程序中使用sweetalert2来管理服务器的响应,但是在触发以下错误后它立即崩溃 [错误:对象作为React子对象无效(找到:带有键{params} ...的对象)
Error: Objects are not valid as a React child (found: object with keys {params}). If you meant to render a collection of children,use an array instead.
in form (at Login.jsx:95)
in div (at Login.jsx:86)
in main (created by ForwardRef(Container))
in ForwardRef(Container) (created by WithStyles(ForwardRef(Container)))
in WithStyles(ForwardRef(Container)) (at Login.jsx:85)
in div (at Login.jsx:84)
in div (at Login.jsx:83)
in div (at Login.jsx:78)
in Login (created by Context.Consumer)
in Route (at App.js:22)
in Switch (at App.js:20)
in Router (created by BrowserRouter)
in BrowserRouter (at App.js:19)
in div (at App.js:18)
in App (at src/index.js:11)
in StrictMode (at src/index.js:10)
我已根据要求声明了Swal >>>
从“ sweetalert2”导入Swal;
从“ sweetalert2-react-content”导入withReactContent;
const MySwal = withReactContent(Swal);
MySwal.fire({图标:“成功”,标题:“ Great !!!”,文本:“ hello”, 计时器:1500,})
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。