Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Toastify React, error when attempting to use

When ever I attempt importing tosify into react:

Using the following:

import { ToastContainer, toast } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css';

I get the following error:

Failed to compile.

./node_modules/react-toastify/dist/react-toastify.esm.mjs Can't import the named export 'cloneElement' from non EcmaScript module (only default export is available)

Not sure what solution is and have spent alot time trying to find solution but I am unable too, if anything else is needed let me know but when the tosify import not there the site works fine.

like image 362
Clinton Avatar asked Dec 13 '25 00:12

Clinton


1 Answers

Try by changing the version to older version of toastify. Manually add this in your package.json file "react-toastify": "^8.1.0", , and then run npm i then again run npm start.

like image 175
Steve Avatar answered Dec 15 '25 13:12

Steve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!