javascript - Error: firebase.admob() InterstitialAd.show() The requested InterstitialAd has not loaded and could not be shown - Stack Overflow

PHOTO EMBED

Thu May 13 2021 18:46:14 GMT+0000 (Coordinated Universal Time)

Saved by @kevtucker

useEffect(() => {
    const eventListener = interstitial.onAdEvent(type => {
      if (type === AdEventType.LOADED) {
        setLoaded(true);
      }
      if (type === AdEventType.CLOSED) {
        console.log("ad closed");
        setLoaded(false);
       
        //reload ad 
        interstitial.load();
      }
    });

    // Start loading the interstitial straight away
    interstitial.load();

    // Unsubscribe from events on unmount
    return () => {
      eventListener();
    };
  }, []);
content_copyCOPY

https://stackoverflow.com/questions/62884470/error-firebase-admob-interstitialad-show-the-requested-interstitialad-has-n