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.