Replies: 1 comment
-
What you can do is create 3 corresponding toasts for all pending, success and error state const pendingNotif = (text) => toast(text);
const errorNotif = (text) => toast.error(text);
const successNotif = (text) => toast.success(text); And depending upon the current status, you can display them accordingly if (currStatus === "pending") {
pendingNotif("Your data is being submitted!");
}
if (currStatus === "success") {
successNotif("Your message has been sent successfully!");
}
if (currStatus === "error") {
errorNotif(reqError);
} Toast container use case: <ToastContainer
style={{ fontSize: 15, width: 400 }}
position="top-center"
autoClose={3000}
hideProgressBar={false}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
theme="dark"
/> Do let me know if updating to this code snippet solves your code... ✨🙂 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everybody,
I need your help. I want to initialized a Toast instance with React.userRef, but without launch it, because I want to use that Ref Id to update any Toast type, and I don't know which Toast type (info, error, success) happens first.
For example:
But the line
alertToast.current = toast('')
always launch the ToastThanks for your help.
Beta Was this translation helpful? Give feedback.
All reactions