Reactjs 尝试导入错误:';附传单';不是从';反应传单';
代码:Reactjs 尝试导入错误:';附传单';不是从';反应传单';,reactjs,npm,leaflet,react-leaflet,Reactjs,Npm,Leaflet,React Leaflet,代码: import { withLeaflet} from "react-leaflet"; Attempted import error: 'withLeaflet' is not exported from 'react-leaflet'. 我只想导入With传单,但它给了我这个错误 错误: import { withLeaflet} from "react-leaflet"; Attempted import error: 'withLe
import { withLeaflet} from "react-leaflet";
Attempted import error: 'withLeaflet' is not exported from 'react-leaflet'.
我只想导入With传单,但它给了我这个错误
错误:
import { withLeaflet} from "react-leaflet";
Attempted import error: 'withLeaflet' is not exported from 'react-leaflet'.
package.json>依赖项
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"leaflet": "^1.7.1",
"leaflet-rotatedmarker": "^0.2.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-leaflet": "^3.0.2",
"react-leaflet-rotatedmarker": "^0.1.0",
"react-scripts": "4.0.1",
"web-vitals": "^0.2.4"
您使用的是react传单3,您不再使用With传单,您需要使用他们的挂钩。@非常感谢您的帮助,您是对的,那么如何更改代码以在v3上工作?你能给我看看吗?我不理解那里关于钩子的文档,不知道该怎么做才能使它起作用。你使用react传单3,你不再使用With传单,你需要使用他们的钩子来代替它。@非常感谢有人这么说,你是对的,那么你如何将代码更改为在v3上工作?你能给我看看吗?我不理解钩子上的文档,不知道该怎么做才能工作。