Home > OS >  I just started building my react.js portfolio but when I use npm start, nothing shows in my browser.
I just started building my react.js portfolio but when I use npm start, nothing shows in my browser.

Time:01-03

Below are my Header.js component and App.js respectively,

// Header.js

import React from 'react'
import { Link } from 'react-router-dom'


const Header = () => {
    return (
        <div className='header'>
            <nav>

              <div className= 'logo'>
                <h1>
                    Damien 
                </h1>
              </div>

              <ul className='ul-items'>
                <li>
                    <Link to= '#'>Home 
                    </Link>
                </li>

                <li>
                    <Link to= '#'>Projects 
                    </Link>
                </li>

                <li>
                    <Link to= '#'>About 
                    </Link>
                </li>

                <li>
                    <Link to= '#'>Contact 
                    </Link>
                </li>

                <li>
                    <Link to= '#'>Services 
                    </Link>
                </li>
              </ul>
            </nav>

        </div>
    )

}
export default Header;

//App.js


```
import './App.css';

const App = () => {
  return (
    <div className="App">
      <Header/>
    </div>
  );
}

export default App;

```

Idk what else to try, Ive looked on youtube for tutorials and googled my problem and have found nothing

CodePudding user response:

The code looks alright. Have you tried npm i in your terminal?

CodePudding user response:

I think it is beacause you use <Link> from react-router-dom but you didn't set a Router

https://v5.reactrouter.com/web/guides/quick-start/1st-example-basic-routing

CodePudding user response:

you must checkout your "scripts section" in your package.json document also checkout if you are in the right Working Directory for execute the script "start" place in the project folder

  • Related