有人可以告诉我如何将外部js文件添加到我们的react组件中,或者在我们的index.html或正文中。
尽可能提供代码
答案 0 :(得分:1)
要在React代码中导入外部js文件。您只需要在 index.html 文件中写一行。
export const environment = {
production: true,
firebase : {
apiKey: "API KEY", //add your API and same for rest keys
authDomain: "DOMAIN NAME",
databaseURL: "DATA BASE URL",
projectId: "PROJECT ID",
storageBucket: "STORAGE BUCKET",
messagingSenderId: "MESSAGING ID",
appId: "AP ID",
measurementId: "MEASUREMENT ID"
}
};
或
<script type="text/JavaScript" src="name of the file with extension"></script>