reactjs - 如何在反应中添加我们的外部js文件
问题描述
谁能告诉我我们如何将外部 js 文件放入我们的 react 组件、index.html 或正文中。
尽可能提供代码
解决方案
在 React 代码中导入外部 js 文件。您只需要在index.html文件中写一行。
<script type="text/JavaScript" src="name of the file with extension"></script>
或者
<script type="text/JavaScript" src="url of the file on server"></script>
推荐阅读
- python - 如何将缺少的类别从火车添加到测试数据集中?
- javascript - Web3 签名两倍长
- python - 逐行替换值
- list - 包装小部件列表不更新列表 Flutter
- c# - 家庭作业问题 C# 函数返回“System.Linq.Enumerable+WhereSelectListIterator`2[Exercise6.Exercise6+Student,System.String]”
- github - GitHub 代码没有更新到网页
- android - Android - 在华为通话时以编程方式启用扬声器
- c++ - 计算不重复字符的子字符串(具有唯一字符的子字符串总数)
- python - 谷歌浏览器没有在非活动模式下渲染 DOM?
- c# - C#错误:该文件被另一个进程使用...(试图使用文件杀死进程但不起作用)