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

132
Vistas
Trying to implement a script into React

I am trying to insert this Trading view script into my react project: https://www.tradingview.com/widget/market-overview/

This is my component:

import React, { useEffect } from "react";
import "./LiveCoinWatch.css";

export default function LiveCoinWatch() {
  const src = "https://s3.tradingview.com/external-embedding/embed-widget-market-overview.js";

  useEffect(() => {
    const script = document.createElement("script");
    script.src = src;
    script.async = true;
    script.innerHTML = {
  colorTheme: "dark",
  dateRange: "1M",
  showChart: true,
  locale: "en",
  width: "100%",
  height: "100%",
  largeChartUrl: "",
  isTransparent: true,
  showSymbolLogo: true,
  showFloatingTooltip: false,
  plotLineColorGrowing: "rgba(255, 229, 153, 1)",
  plotLineColorFalling: "rgba(180, 167, 214, 1)",
  gridLineColor: "rgba(0, 0, 0, 0)",
  scaleFontColor: "rgba(120, 123, 134, 1)",
  belowLineFillColorGrowing: "rgba(180, 167, 214, 0.12)",
  belowLineFillColorFalling: "rgba(255, 229, 153, 0.12)",
  belowLineFillColorGrowingBottom: "rgba(41, 98, 255, 0)",
  belowLineFillColorFallingBottom: "rgba(41, 98, 255, 0)",
  symbolActiveColor: "rgba(217, 210, 233, 0.12)",
  tabs: [
    {
      title: "TestPage",
      symbols: [
        {
          s: "BITSTAMP:BTCUSD",
        }
      ],
    },
  ],
};

document.body.appendChild(script);

return () => {
  document.body.removeChild(script);
};
}, [src]);

return (
<div class="tradingview-widget-container">
  <div class="tradingview-widget-container__widget"></div>
</div>
  );
}

I tried to get element by id and to remove his child. Btw i dont know why should i remove the child div after using this. I tried to make a new div and to append and remove the child from it, but i got this error:

NotFoundError: Node.removeChild: The node to be removed is not a child of this node

Thanks everyone who would help!

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