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

203
Vistas
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 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