Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

135
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda