My index.js is..
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
ReactDOM.render(<App />, document.querySelector("#root"));
My App.js is …
import React from "react";
import { BrowserRouter as Router,Routes, Route } from "react-router-dom";
import Join from "./components/Join";
import Chat from "./components/Chat";
const App = () => {
return (
<Router>
<div>
<Routes>
<Route path="/" exact component={Join} />
<Route path="/chat" component={Chat} />
</Routes>
</div>
</Router>
);
}
export default App;
I’m not able to find out the error, either App is not exporting properly or there’s some issue on router or problem is with rendering. I don’t know
and join component is
import React from "react";
const Join = () => {
return (
<h1>Hiii Join</h1>
)
}
export default Join;
Ideally it should display Hii Join but browser is blank.
2
Answers
Can you share a screenshot of the issue, as nothing seems that wrong. Also, how are you running the project?
Here is my code…
Was it helpful?