reactjsreact-toastify

why do I get an error in react-toastify module?


I'm using react-toastify to pop up an error message. Why do I get this error?

TypeError: Object(...) is not a function useToastContainer E:/Courses/programing/Code with Mosh/Front End/Mastering React/08 - Calling Backend Services (01h42m)/Section 8- Calling Backend Services/start/http-app/node_modules/react-toastify/dist/react-toastify.esm.js:866

error

Once I remove ToastContainer component everything works normally. What should I do to get rid of this error, and why do I get it?


Solution

  • I got the same problem here, I guess we are both using the newest version of react-toastify, but after I change the version with 4.1 (which the instructor is using) and it solved !

    First, you need :

    npm uninstall react-toastify --save

    Then, reinstall it with the version 4.1

    npm i react-toastify@4.1