React-hot-toast v4.1.1 is not working in my class component. Earlier I was using React toastify but now I switched to React hot toast. The react-hot-toast is continously giving the error. TypeError: Object(...) is not a function ./node_modules/react-hot-toast/dist/react-hot-toast.esm.js
import toast, { Toaster } from "react-hot-toast";
class Toast extends Component {
handleToast = () => {
toast("Toast Created.");
};
render() {
return (
<div>
<Toaster />
<button className="btn btn-primary" onClick={this.handleToast}>
Create Toast
</button>
</div>
);
}
}
export default Toast;