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

React Router Dom react js Blank white screen Show

I added React Router Dom in my project I want to show chat Area of Specific Area Group. So I am using React Router Dom to Access unique Links
I used React Router Dom Version: 8.1
My Project

App.js

import './App.css';
import Chat from './components/Chat';
import Sidebar from './components/Sidebar';
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";


function App() {
  return (
    
    <div className="app">
      <div className="app_body">
      <Router>
        <Sidebar />
          <Routes>
            <Route path="/">
              
              <Chat/>
            </Route>

          </Routes>
        </Router>
                    </div>
  </div>

    
  );
}

export default App;

After Run Result: Blank White screen showing Before using React Router Dom

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

Output
enter image description here

>Solution :

Try using the element prop

import './App.css';
import Chat from './components/Chat';
import Sidebar from './components/Sidebar';
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";

function App() {
  return ( 
    <div className="app">
      <div className="app_body">
          <Router>
            <Sidebar />
            <Routes>
                <Route path="/" element={<Chat />} />
            </Routes>
          </Router>
      </div>
    </div>
  );
}
export default App;
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