lbry-desktop/lbrytv/component/ads.jsx

38 lines
832 B
React
Raw Normal View History

2020-01-23 17:21:36 +01:00
import React, { useEffect } from 'react';
function Extra(props) {
const url = '//assets.revcontent.com/master/delivery.js';
useEffect(() => {
const script = document.createElement('script');
script.src = url;
script.async = true;
document.body.appendChild(script);
return () => {
document.body.removeChild(script);
// if user navigates too rapidly, <style> tags can build up
if (document.body.getElementsByTagName('style').length) {
2020-01-23 19:44:55 +01:00
document.body.getElementsByTagName('style')[0].remove();
2020-01-23 17:21:36 +01:00
}
};
}, []);
return (
<>
2020-01-23 19:44:55 +01:00
<p>Ads</p>
<div
id="rc-widget-0a74cf"
data-rc-widget
data-widget-host="habitat"
data-endpoint="//trends.revcontent.com"
data-widget-id="117427"
/>
2020-01-23 17:21:36 +01:00
</>
);
2020-01-23 19:44:55 +01:00
}
2020-01-23 17:21:36 +01:00
export default Extra;