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?

3
  • Could you provide a reproducible sandbox? Commented Jun 20, 2020 at 21:25
  • I attached a screen of the error that I get here it is i.sstatic.net/mMnxu.png Commented Jun 20, 2020 at 21:32
  • I'm sorry I'm new here in StackOverflow I don't know how to use it Commented Jun 20, 2020 at 21:34

2 Answers 2

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 [email protected]

Sign up to request clarification or add additional context in comments.

1 Comment

I also needed to restart my development server to changes take effect
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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.