I am importing the d3.js library in my React app like this:
(我正在像这样在我的React应用程序中导入d3.js库:)
import * as d3 from "d3";
I am creating a basic world map, which is also displayed correctly in the browser.
(我正在创建一个基本的世界地图,它也可以在浏览器中正确显示。)
However, when I try to do something like this in Chrome console:(但是,当我尝试在Chrome控制台中执行以下操作时:)
d3.select("path")
I am getting an error:
(我收到一个错误:)
Uncaught ReferenceError: d3 is not defined
(未捕获的ReferenceError:未定义d3)
I guess it has something to do how React works, and being a novice in React right now I don't know what i am missing here right now.
(我猜它与React的工作方式有关,并且作为React的新手,我现在不知道我现在在这里缺少什么。)
Anybody can help?(有人可以帮忙吗?)
ask by JoeBe translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…