Package Exports
- adblock-detect-react
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (adblock-detect-react) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
adblock-detect-react
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>
);
};