Riziki
Riziki

Reputation: 81

Blank page on npm start react

I'm new to React and I'm creating a React app which on npm start it's returning a blank page. Below is :

Here's my index.js

import React from "react";
import ReactDOM from 'react-dom';

import App from '../src/App';

ReactDOM.render(<App />, 
document.getElementById('root'));

App.js

import React from 'react'
import { BrowserRouter as Router, Switch, Route 
} from 'react-router-dom';

const App = () => {
  return (
      <div>
        Ecommerce  
      </div>
  )
}

export default App;

How do I fix this?

Upvotes: 5

Views: 9026

Answers (3)

JesseBoyd
JesseBoyd

Reputation: 1096

For me I didn't realize that another react project I had running was blocking this second project from starting. So by stopping the first react project my second one started working. Another solution would be to give the different projects different ports. This may not be your exact problem but it may solve the title of this question for some people.

Upvotes: 0

bear
bear

Reputation: 1348

I had this problem until just now I turned off my VPN.

  • Turn off VPN
  • restart your app (npm start)
  • let us know if it works

Upvotes: 1

Bailey Jewell
Bailey Jewell

Reputation: 31

Make sure you have installed react-router-dom:

npm i react-router-dom

Upvotes: 3

Related Questions