Reputation: 81
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
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
Reputation: 1348
I had this problem until just now I turned off my VPN.
Upvotes: 1
Reputation: 31
Make sure you have installed react-router-dom
:
npm i react-router-dom
Upvotes: 3