Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!