Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

White blank screen using React Router #1493

Open
onlyfortestweb opened this issue Apr 5, 2019 · 18 comments
Open

White blank screen using React Router #1493

onlyfortestweb opened this issue Apr 5, 2019 · 18 comments

Comments

@onlyfortestweb
Copy link

onlyfortestweb commented Apr 5, 2019

I am use React Router for my web app, it will build successful but its just show blank white screen. Any body help to fix it.
App.js

import React, { Component } from 'react';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import './App.css';
import Home from './Pages/Home.jsx';

class App extends Component {
  render() {
    return (
      <Router>
        <div>
          <Route exact path="/" Component={Home}/>
        </div>
      </Router>
    );
  }
}

export default App;

Home.jsx Code

import React, { Component } from 'react';


class Home extends Component{
    render(){
        return(
            <div>
                <h2>Welcome</h2>
                <p>xc.b nldfgjkln ;fngd golnldf ng</p>
            </div>
        );
    }
}

export default Home;
@meerbex
Copy link

meerbex commented Apr 27, 2020

Have you found a solution for this issue? I am also having the same propbelm. It works perfectly If I am not using router components

@geowasim
Copy link

geowasim commented Feb 19, 2021

I see typeo in App.js
<Route exact path="/" Component={Home}/>
// it should be component(small)

@Imen-Frigui
Copy link

am facing the same problem
any solution?

@rezasanjari
Copy link

use this:


import {BrowserRouter as Router, Route, Routes} from "react-router-dom";

<Routes>
  <Route exact path="/" element={<Home/>} />
</Routes>

@vivekmodi1301
Copy link

Thanks this helped me.
I used element instead of component.

@betu55
Copy link

betu55 commented Apr 22, 2022

I am having the same problem. I used the same import but still nothing.

@abdrzqsalihu
Copy link

Please I need help with this also

@devesh911
Copy link

devesh911 commented Jul 3, 2022

i think the problem is arrising from components itself , i am using a arrow function export component changed to simple rfc

@betu55
Copy link

betu55 commented Jul 3, 2022 via email

@nithiyashree22
Copy link

Have you found a solution for this issue? I am also having the same propbelm. It works perfectly If I am not using router components

I uninstalled the current version and installed the old one by using this command
npm install react-router-dom@5
and things were solved.. dont have to use routes in the place of switch , can add multiple element components in one tag..

@betu55
Copy link

betu55 commented Jul 17, 2022

try updating npm also

@nithiyashree22
Copy link

nithiyashree22 commented Jul 20, 2022

latest

try updating npm also

the latest react router dom is unstable.. the prev version works fine

@River-Child
Copy link

Something should be done about this, no solution works. People's futures depend on things like this. Doing a Mern stack project to apply for a job and all I am seeing is blank pages

@albedim
Copy link

albedim commented Sep 16, 2022

Guys, If you really wanna fix this. The only way is this. Install the old version 😄

@betu55
Copy link

betu55 commented Oct 11, 2022 via email

@ghost
Copy link

ghost commented Oct 29, 2022

Below Link is working fine this is the router version issue , problem will resolve after follow below link instruction with latest Router version.

https://stackoverflow.com/questions/71972523/navlink-link-from-react-router-dom-not-working-blank-screen/71992282#71992282

Thanks
Regards
Rameez Jaffri

@ak0024
Copy link

ak0024 commented May 10, 2023

import React from "react";
import ReactDOM from "react-dom/client";
import { BrowserRouter } from "react-router-dom";

import "./index.css";
import App from "./App";

ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>



</React.StrictMode>
);

do this in index.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests