[Solved] Toastify React, error when attempting to use
React JS
Mohit Mozumder
Problem:
When ever I attempt importing tosify into react i got 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)
Solution 1:
Try by downgrade the version of toastify. In your package.json file-
"react-toastify": "^8.1.0"
and now run npm i then again run npm start.
Solution 2:
Update your node version and react version-
npm install --save react@latest npm install -g npm-check-updates npm audit fix --force
Thank you for reading the article. If you face any further problem feel free to contact with us.