1.3.1 • Published 1 year ago

adblock-detect-react v1.3.1

Weekly downloads
275
License
MIT
Repository
github
Last release
1 year ago

adblock-detect-react

npm version Publish Status

Description

Provides utilities to check if ad block is enabled on a page via either a React hook or a wrapper component.

Example Usage

useDetectAdBlock hook

import React from "react";
import { useDetectAdBlock } from "adblock-detect-react";

const SomeFunctionalComponent = () => {
  const adBlockDetected = useDetectAdBlock();

  React.useEffect(() => {
    if (adBlockDetected) {
      window.alert("ad block detected");
    }
  }, []);

  return <div>{adBlockDetected && "Hello Ad Blocked Page"}</div>;
};

AdBlockDetectedWrapper component

import React from "react";
import { AdBlockDetectedWrapper } from "adblock-detect-react";

const SomeFunctionalComponent = () => {
  return (
    <AdBlockDetectedWrapper>
      <div>{"Hello Ad Blocked Page"}</div>
    </AdBlockDetectedWrapper>
  );
};
1.3.1

1 year ago

1.2.0

1 year ago

1.3.0

1 year ago

1.1.0

3 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

1.0.0-beta.2

5 years ago

1.0.0-beta.1

5 years ago

1.0.0-beta.0

5 years ago