Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to switch a particular component in home page from another page in react

I have 3 pages: "Home", "About us", and "Contact", but have 2 sections like "testimonial" and "faq" which are home page components. Now I can move to those sections from home page but I am unable to move when I am in other page. How to achieve this?

Navbar

I am trying in this way to move or to scroll these testimonial and faq section;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Nav.js

<Nav.Link className='navoption'>
  <Link to='#testimonials' smooth>
    Testimonals
  </Link>
</Nav.Link>

<Nav.Link className='navoption'>
  <Link to='#faq' smooth>
    Faq
  </Link>
</Nav.Link>

Home.js

<div id='testimonials'>
  <div className="container" data-aos="fade-up">
    <h3 className="alumni1" style={{ marginTop: '100px' }}>Testimonials</h3>
    <hr
      className="mx-auto"
      style={{
        border: '2px solid red',
        marginBottom: '30px',
        width: '50px'
      }}
    />
    <p
      style={{
        fontSize: '20px',
        fontWeight: '400',
        textAlign: 'center',
        marginBottom: '65px'
      }}
    >
      Magnam dolores commodi suscipit. Necessitatibus eius consequatur ex aliquid fuga eum quidem. Sit sint consectetur velit. Quisquam quos quisquam cupiditate. Et nemo qui impedit suscipit alias ea.
    </p>
    <div className="row">

Thanks in advance….

>Solution :

i think it works, give this code a try-

<Link to={{pathname:"/home",hash:"testimonials"}}> Testimonials</Link>

Hope this code will help you, if you still facing just lemme know, I will help you more.
Thanks

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading