Cannot convert object to primitive value error in react application? Cannot convert object to primitive value error in react application? reactjs reactjs

Cannot convert object to primitive value error in react application?


First, remove jQuery:

npm remove jquery

and then reinstall it:

npm install jquery@~3.4.1


I had the same problem in a rails 6 project I was developing. I am using bootstrap 4.4.1 and had the exact same problem with my collapsing navigation bar: The navbar collapses but the hamburger button which appears on collapse was not clickable.

The solution: Downgrade jquery from 3.5.0 to 3.4.1. I did not look into the actual reason of the error for now.

To add more details, the jquery version should be updated in package.json dependencies and don't forget to run yarn install --check-files after you do this for the change to be applied.


This is related to jQuery 3.5.0. It is a breaking change that affects many plugins. Temporarily reverting to a previous version of jQuery (like 3.4.1) fixed the issue for me.

or

Locate your Jquery package in project node_modules, delete it and reinstall it using this command

npm install jquery@~3.4.1

Source: jQuery Issue #4665