Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

225
Vistas
How I dynamically add and load an external script in react

I am trying to render a script tag from a react component, I have tried to manually create script tag element but it does not load the .js I am trying to display a widget. For now I have included it into the main index.html file. Is that the only method or am I missing something.

PS:-I cant test the api anymore as I have consumed all my daily requests

I have looked into the script js tag it targets elements by getElementbyid function but nothing renders on my page

import { React, useEffect, useState } from "react";

const Upcoming_matches = () => {
  return (
    <>
      <div
        id="wg-api-football-fixtures"
        data-host="v3.football.api-sports.io"
        data-refresh="60"
        data-date="2022-02-11"
        data-key="xxx-xxx-xxx"
        data-theme="dark"
        data-show-errors="true"
        className="api_football_loader"
      ></div>
    </>
  );
};

export default Upcoming_matches;
 

the script tag

<script
      type="module"
      src="https://widgets.api-sports.io/football/1.1.8/widget.js">
  </script>
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda