toast not working with onClick in React
** BUG REPORT **
toast not showing up using onClick event
I have a button component with the following definition:
<Button color="info" onClick={() => addToCart(item)}>
Buy Now
</Button>
addtocart function:
const addToCart = (item) => {
console.log(item, "added");
toast("🛒 success", {
position: "top-left",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
});
};
The function is being called properly as the console.log(item,"added") line is working fine.
Expected behavior: toast must be displayed but is not being rendered
** BUG REPORT **
toast not showing up using onClick event
I have a button component with the following definition:
<Button color="info" onClick={() => addToCart(item)}> Buy Now </Button>addtocart function:
const addToCart = (item) => { console.log(item, "added"); toast("🛒 success", { position: "top-left", autoClose: 5000, hideProgressBar: false, closeOnClick: true, pauseOnHover: true, draggable: true, progress: undefined, }); };The function is being called properly as the
console.log(item,"added")line is working fine. Expected behavior: toast must be displayed but is not being rendered
The same issue, have got the solution?
** BUG REPORT ** toast not showing up using onClick event I have a button component with the following definition:
<Button color="info" onClick={() => addToCart(item)}> Buy Now </Button>addtocart function:
const addToCart = (item) => { console.log(item, "added"); toast("🛒 success", { position: "top-left", autoClose: 5000, hideProgressBar: false, closeOnClick: true, pauseOnHover: true, draggable: true, progress: undefined, }); };The function is being called properly as the
console.log(item,"added")line is working fine. Expected behavior: toast must be displayed but is not being renderedThe same issue, have got the solution?
I basically used the toast type with the toast as
toast.warning("❕ Item already exists", {
position: "top-right",
autoClose: 2000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: false,
draggable: true,
progress: undefined,
});
** BUG REPORT ** toast not showing up using onClick event I have a button component with the following definition:
<Button color="info" onClick={() => addToCart(item)}> Buy Now </Button>addtocart function:
const addToCart = (item) => { console.log(item, "added"); toast("🛒 success", { position: "top-left", autoClose: 5000, hideProgressBar: false, closeOnClick: true, pauseOnHover: true, draggable: true, progress: undefined, }); };The function is being called properly as the
console.log(item,"added")line is working fine. Expected behavior: toast must be displayed but is not being renderedThe same issue, have got the solution?
I basically used the toast type with the toast as
toast.warning("❕ Item already exists", { position: "top-right", autoClose: 2000, hideProgressBar: false, closeOnClick: true, pauseOnHover: false, draggable: true, progress: undefined, });
I used toast.configure(); this is works for me!