// Effect function const ShowAdButton = () => { React.useEffect(() => { if (window.show_8524924) { return } const tag = document.createElement('script') tag.src = '//psaunsooksuthi.com/vignette.min.js' tag.dataset.zone = '8524924' tag.dataset.sdk = 'show_8524924' document.body.appendChild(tag) }, []) const showAd = () => { show_8524924().then(() => { // add here the function that should be executed after viewing the ad }) } return } // Effect function const ShowAdButton = () => { React.useEffect(() => { if (window.show_8524924) { return } const tag = document.createElement('script') tag.src = '//psaunsooksuthi.com/vignette.min.js' tag.dataset.zone = '8524924' tag.dataset.sdk = 'show_8524924' document.body.appendChild(tag) }, []) const showAd = () => { show_8524924().then(() => { // add here the function that should be executed after viewing the ad }) } return }