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

506
Visualizações
NextJS Script TradingView widget configuration

While transferring the best stock article on my website from Jekyll to NextJS I can't figure out how to pass widget configuration to the built-in Script component, it simply doesn't display the widget. Here is the code:

import Script from 'next/script'

export default function StockSnippet({Exchange, Ticker}) {
return <>
    <Script src="https://s3.tradingview.com/external-embedding/embed-widget-mini-symbol-overview.js">               
    {{"symbol": `${Exchange}:${Ticker}`,
        "width": "100%",
        "height": "100%",
        "locale": "en",
        "dateRange": "12M",
        "colorTheme": "light",
        "trendLineColor": "rgba(41, 98, 255, 1)",
        "underLineColor": "rgba(41, 98, 255, 0.3)",
        "underLineBottomColor": "rgba(41, 98, 255, 0)",
        "isTransparent": false,
        "autosize": true,
        "largeChartUrl": ""}}
    </Script>
</>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Try turning your data into a JSON string by calling JSON.stringify

export default function StockSnippet({ Exchange, Ticker }) {
    const wrapperStyle = {
        width: "100%",
        height: "100%"
    }
    return <>
        <div id="tradingview-wrapper" style={wrapperStyle}>
            <Script
                id="tradingview-widget"
                src="https://s3.tradingview.com/external-embedding/embed-widget-mini-symbol-overview.js"
                onLoad={() => {
                    document.getElementById('tradingview-wrapper').appendChild(document.getElementById('tradingview-widget'));
                }}>
                {JSON.stringify({
                    "symbol": `${Ticker}:${Exchange}`,
                    "width": "100%",
                    "height": "100%",
                    "locale": "en",
                    "dateRange": "12M",
                    "colorTheme": "light",
                    "trendLineColor": "rgba(41, 98, 255, 1)",
                    "underLineColor": "rgba(41, 98, 255, 0.3)",
                    "underLineBottomColor": "rgba(41, 98, 255, 0)",
                    "isTransparent": false,
                    "autosize": true,
                    "largeChartUrl": "",
                })}
            </Script>
        </div>
    </>
}
about 4 years ago · Juan Pablo Isaza Relatório
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