Open cparjaszewski opened 7 years ago
For me this was caused by the devDependencies of react-d3-map-core containing react, which causes duplicate react libraries to get loaded. I'm using yarn, so this behavior might not happen with 'npm install' ?
One solution I found is to change webpack config to add something like the following:
resolve: {
alias: {
"react": __dirname + '/node_modules/react',
}
}
But in my case I'm using create-react-app so I don't have direct access to webpack config. So my solution was to use react-app-rewired, and then in its config-overrides.js file in the override function I added these lines:
// Force all react references to resolve to the main one (fixes issue with react-d3-map-core devDependencies)
config.resolve = config.resolve || {};
config.resolve.alias = config.resolve.alias || {};
config.resolve.alias['react'] = path.join(__dirname, 'node_modules', 'react');
return config;
When I'm trying to render Map with MarkerGroup I'm getting this error:
Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's
render
method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).Here is part of my package.json: