Blank page in browser after running build on create-react-app on localhost

I am creating an app that consume rest api and display the results, after completing the
app and i ran the build it shows blank screen see the code below

import React from "react";
import Home from "./webpages/Home";

function App() {
  return (
    <div>
      <Home />
    </div>
  );
}
export default App;
import React from "react";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import User from "./User";
import UserDetail from "./UserDetail";

const Home = () => {
  return (
    <Router>
      <Routes>
        <Route path="/" exact component={User} />
        <Route path="/user/:id" component={UserDetail} />
      </Routes>
    </Router>
  );
};
export default Home;
import React, { useState, useEffect } from "react";
import { Link } from "react-router-dom";

const User = () => {
  const [error, setError] = useState(null);
  const [isLoaded, setIsLoaded] = useState(false);
  const [users, setUsers] = useState([]);

  useEffect(() => {
    fetch("https://jsonplaceholder.typicode.com/users/")
      .then((res) => res.json())
      .then(
        (data) => {
          setIsLoaded(true);
          setUsers(data);
        },
        (error) => {
          setIsLoaded(true);
          setError(error);
        }
      );
  }, []);
  if (error) {
    return <div>Error: {error.message}</div>;
  } else if (!isLoaded) {
    return <div>Loading...</div>;
  } else {
    return (
      <ul>
        {users.map((user) => (
          <li>
            <Link to={`user/${user.id}`}>{user.name}</Link>
          </li>
        ))}
      </ul>
    );
  }
};
export default User;

Kindly advise on how the list of users can be displayed, since it is not given any error

Thanks in advance

Hi,
It does the same here.
But should you check the developer console it explains your problem.

This is because React-Router 6 has changed how you use the route component. See the docs

Change

<Route path="/" exact component={User} />
<Route path="/user/:id" component={UserDetail} />

to

<Route path="/" exact element={<User/>} />
<Route path="/user/:id" element={<UserDetail/>} />

Regards.

Hi UniqueNospaceShort thank you it works