I have tried multiple anchor link libraries for ease of active classes in order to scroll to sections of my page when clicking through the nav bar. Using a normal anchor element, as in <a href='#content'>test</a>
snaps to the element with the corresponding ID, however no scroll libraries have worked at all. My latest attempt, React-Scroll, for example. Here is my nav component (simplified for readability):
import React from 'react'
import styled from 'styled-components'
import styles from './SideNav.module.scss'
import { FaGithubSquare, FaLinkedin } from 'react-icons/fa'
import { Link, animateScroll as scroll } from 'react-scroll'
const SideNav = () => {
return(
<div className={styles.sideNav}>
<div className={styles.navElements}>
<section className={styles.brand}>
<h1 className={styles.name}>Josh Bangle</h1>
<h3>Web Dev. Voice Actor. Dad. Nerd.</h3>
</section>
<ul className={styles.navList}>
<Link to='test1' spy={true} smooth={true} offset={50} duration={500}>test link</Link>
</ul>
<div className={styles.socials}>
<a href='https://www.github.com/joshbangle' rel="noopener noreferrer" target='_blank' className={styles.github}><FaGithubSquare size={50} /></a>
<a href='https://www.linkedin.com/in/joshbangle' rel="noopener noreferrer" target='_blank' className={styles.linkedin}><FaLinkedin size={50} /></a>
</div>
</div>
</div>
)
}
export default SideNav
And the component with the corresponding ID in it:
import React from 'react';
import styled from 'styled-components'
const Contact = () => {
return (
<section id='test1'>
<ContactContent>
<Headline>Contact me</Headline>
<h1>Feel free to reach out to me through LinkedIn, or email me directly at:</h1>
<Email>joshua.bangle@gmail.com</Email>
</ContactContent>
</section>
);
}
export default Contact;
I have tried multiple packages, multiple ways of writing the anchor, and just nothing at all happens. I'm starting to wonder if somehow another package I have installed is interfering with the scroll functionality of packages. If that is possible at all, I can link to the github repo if anyone is willing to check it out. Thanks in advance for any help.