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

206
Visualizações
Google Adsense in React Component - using react-adsense

I am trying to include Google Adsense in a React component using 'react-adsense'.

I have followed the creator's instructions here.

I am getting the following error:

{message: 'adsbygoogle.push() error: No slot size for availableWidth=0', name: 'TagError', pbr: true, stack: 'TagError: adsbygoogle.push() error: No slot size f…oogle.js?client=ca-pub-1034524975771842:102:1098)'}

I have looked into this error and tried the suggestions here, here, and here.

From what I can tell it has something to do with a parent div's width. I've gone through and made sure everything has a set width but no luck. Am I overlooking something super obvious??

REACT COMPONENT

import React from 'react';
import '../styles/ads.css';
import AdSense from 'react-adsense';

const Ads = () => {
  return (
    <div className='ads'>
      <AdSense.Google
        client='ca-pub-1034524975771842'
        slot='3468851388'
        style={{ display: 'block' }}
        format='auto'
        responsive='true'
        layoutKey='-gw-1+2a-9x+5c'
      />
    </div>
  );
};

export default Ads;

APP.JS

import './styles/app.css';
import React from 'react';
import Ads from './components/Ads';

function App() {
  return (
    <div className='app'>
      <Ads />
    </div>
  );
}

export default App;
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