I am fetching data (html content) from an API and setting it as an dangerioslyinnerhtml in ReactJS. I want to make an image popup using fancyapps/UI and in order to do that, I have to replace this,
<div className="img-parent">
<img className='fancybox' src="" alt="" />
</div>
with this
<Fancybox options={{ infinite: false }}>
<button
data-fancybox="gallery"
data-src={require("source-of-image")}
className="button button--secondary">
<img className='fancybox' src={require("source-of-image")} alt="" />
</button>
</Fancybox>
Any ideas with .replaceAll
function in JS?
I tried to explain my problem in details and I want some experienced people to help.