Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client-Side Code update in page.js code file. #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vignesh1507
Copy link

If you want to perform any DOM manipulation (like document.getElementById()), it's important to remember that React follows a server-side rendering model. To avoid accessing the DOM before it's rendered on the client-side, you should wrap scrollToSection in a useEffect hook or ensure that it runs only after the component mounts.

useEffect(() => {
  const section = document.getElementById("more-section");
}, []);

A minor suggestion:

window.scrollBy({ top: -1 }) scrolls the page up by one pixel, which may not be noticeable. If you're trying to fine-tune the position after scrolling, this might be too small.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant