0

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?

Yilmaz
  • 35,338
  • 10
  • 157
  • 202
Ahmed Joda
  • 23
  • 2
  • 6

2 Answers2

3

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

Pelic
  • 46
  • 2
1

Building on Pelic's answer, after uninstalling the latest version and reinstalling version 4.1, i had to restart my VSCode to get it to work!

Pete Allen
  • 56
  • 1
  • 5