paige asked 3 months ago in MDB pro, version:4.2.0

I’m sure you guys are working really hard over there, and my team I appreciate your work, but there are definitely some issues with your product that need attention. We want to use the Navbar but we can’t get past this error. Uncaught Error: Element ref was specified as a string (navbar) but no owner was set. You may have multiple copies of React loaded. (details: We’ve tried all the suggested fixes(uninstalling mdbreact and adding package manually to our package.json with the links provided. I’ve actually tried two of them, one ending in .git, and another ending in “update”. Neither of these “fixes” have worked for us. Please help us out here. We really can’t waste much more time with this. Some good docs or help with these common and widespread issues would really be appreciated!

1 Answers
Jakub Strebeyko answered 3 months ago

Hi there paige,

Thanks for reaching out! First, please make sure you have followed the installation guide completely. The message not unequivocal, pointing at two possible trouble sources.

First, it may have to do with (well, obviously) navbar ref being a string, as this practice is being depreciated in newer versions of React. This case scenario issue is being taken care of as we speak, and to fix it locally, please visit the MDB React node module (node_modules/mdbreact/src/components/Navbar.js) and make sure there is no string ref (i.e. ref='navbar' or ref=this.state.navbar, whereas in state you would have something like navbar: 'navbar'). Deleting these (or replacing them with a ref function, if you must) should solve the issue.

The other case scenario is more complex, as it involves having conflicting React versions installed simultaneously. It would be helpful to know what version of React you are using in your project – for that you can simply compare package.json files of the project and of 'mdbreact'. If they differ, it might require manual update of either of packages.

Hope it helps!

With Best Regards,