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

Logo not linked back to the homepage?

I am trying to link my logo, so that it takes the user back to the homepage, however the following line of

<div><img src = {Logo} alt='Logo' className='Logo' to={"/"}/></div>

does not seem to be working.

This line can be found within the following App.js

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

function App() {
  return (
    <div className="App">
      <nav className="navbar navbar-expand-lg navbar-light fixed-top">
        <div className="container">
        <div><img src = {Logo} alt='Logo' className='Logo' to={"/"}/></div>
          <div className="collapse navbar-collapse" id="navbarTogglerDemo02">
            <ul className="navbar-nav ml-auto">
              <li className="nav-item">
                <Link className="nav-link" to={"/sign-in"}>Login</Link>
              </li>
              <li className="nav-item">
                <Link className="nav-link" to={"/sign-up"}>Sign up</Link>
              </li>
            </ul>
          </div>
        </div>
      </nav>
      <div className="auth-wrapper">
        <div className="auth-inner">
          <Routes>
            <Route path='/' element={<Home />} /> // components on element prop
            <Route path="/sign-in" element={<Login />} />
            <Route path="/sign-up" element={<SignUp />} />
          </Routes>
        </div>
      </div>
    </div>
  );
}
export default App;

Homepage is also as follows

import React, { Component } from "react";
export default class Home extends Component {
    render() {
        return (
         <h1>home</h1>
        );
    }
}

>Solution :

I think you just need to wrap the image in a Link

<Link to = '/'> 
  <div>
    <img src = {Logo} alt='Logo' className='Logo'/>
  </div>
</Link>
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