How to load script in react component

前端 未结 5 1850
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 16:45

I am having following script file



        
5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-29 17:21

    This came to my rescue. This is the easiest way to load Script Tags

    https://www.npmjs.com/package/react-script-tag

    import ScriptTag from 'react-script-tag';
    
    const Demo = props => (
    
    );
    

    There are other ways to do this too :

    https://medium.com/better-programming/4-ways-of-adding-external-js-files-in-reactjs-823f85de3668

提交回复
热议问题