Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

React - conditional rendering of scrollTo effect

0 votes
93 views
added Apr 16 in React by lcjr Second Warrant Officer (6,120 points)
retagged Apr 19 by lcjr
const scrollToFeaturedContent = () => {
  window.scrollTo(0, scrollToRef.current.offsetTop - 54);
};

const onLordPick= () => {
  setNewsData(loadPick);
  setNewsType(0);
  if (isSticky) {
    scrollToFeaturedContent();
  }
};

 

1 Response

0 votes
responded Apr 19 by lcjr Second Warrant Officer (6,120 points)
const scrollToTransactionRef = () => window.scrollTo(0, transactionRef.current.offsetTop + 460);

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...