Using a component written by native JS, depending on zrender.js and D3.js, how to use this component in a react project

background:
there is a need to implement a tree view that can be expanded up and down. Due to the limited ability, the master can only write traditional JS,. He encapsulated it with traditional JS, and the directory is as follows:

d3.jszrender.js,reactreactzrenderzrender<script>

then copy the amtree object in amtree.js to the tools.js of react.
question:
now I still report zrender is not defined in the tools.js file. Do I still need import zrender, in this file, but the zrender, installed using npm is not the same as the native one? what should I do?

Jun.29,2021
Change the zrender in

tools.sjs to window.zrender (assuming your object's missing name is zrender)


const zrender = require ("lib/zrender.js")

Menu