I want to reference an external js file in the js file of react. How should I write it?

I want to reference this js file

<script src="https://img.codeshelper.com/upload/img/2021/03/29/bfufrb0j1wn14072.png";

class Basic extends React.Component {

    constructor() {
        super();
        this.state = {
            isShowAll: false
        }
    }

    render() {
        return (
            <div className={"content_div"}>
                <div className={"content_img"}>
                    <div className={"content_word"}>
                        <div className={"content_join"}></div>
                        <div className={"content_join_word"}> </div>
                    </div>
                </div>

            </div>
        )
    }
}

export default Basic;

Mar.29,2021

The processing in

react-amap is like this. You can refer to:

// 
new APILoader({
    key: props.amapkey,
    useAMapUI: props.useAMapUI,
    version: props.version,
    protocol: props.protocol
}).load().then(() => {

})

APILoader.js Code https://github.com/ElemeFE/react-amap/blob/next/components/utils/APILoader.js


provides an idea to add a script tag to the DOM before the component is loaded.

  const s = document.createElement('script');
  s.type = 'text/javascript';
  s.src = 'http://baidu.com/asasasasasa/.....';
  document.body.appendChild(s);

is referenced in index.html, that is, html



is in index.html. If you don't believe it, introduce a jQ test, and then print $and you should be able to print something

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e54ef2-44a7c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e54ef2-44a7c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?