'how to call a function with onclick in AMP page
Trying to call fetch api, on press of an image, it looks I checked AMP events docs but cant help..
amp content looks like below;
const callFetchAPI = () => {
fetch('https://preview.amp.dev/static/samples/json/examples.json').then(
(response) => response.json()
)
}
return (
<a
target="_blank"
on="tap:callFetchAPI"
href="https://yahoo.com"
>
<amp-img
role="button"
tabIndex={0}
id="clickEvent"
width="320"
height="150"
src={myurl}
alt=""
className="w-100"
layout="responsive"
/>
</a>
how to trigger that function above on press?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
