问题描述
我正在尝试在我的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 (将#修改为@)