Can someone help me how can I do this in Reactjs?
Can I iterate one IntersectionObserver for multiple child in reactjs
const faders = document.querySelectorAll('.fade-in');
const appearOptions = {
threshold: 1
};
const appearOnScroll = new IntersectionObserver( function(entries, appearOnScroll){
entries.forEach(entry => {
if(!entry.isIntersecting){
return;
}else{
entry.target.classList.add('appear')
appearOnScroll.unobserve(entry.target)
}
})
}, appearOptions);
faders.forEach(fader =>{
appearOnScroll.observe(fader)
})