ReactJs: 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 (
      <Home />
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 (
        <Route path="/" exact component={User} />
        <Route path="/user/:id" component={UserDetail} />
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(() => {
      .then((res) => res.json())
        (data) => {
        (error) => {
  }, []);
  if (error) {
    return <div>Error: {error.message}</div>;
  } else if (!isLoaded) {
    return <div>Loading...</div>;
  } else {
    return (
        { => (
            <Link to={`user/${}`}>{}</Link>
export default User;

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

Thanks in advance


There is nothing obvious in your code that would be causing an error.

Did you try inspecting the console / network tab already? These might give you a clue as to what is not working.

Otherwise, if you want to stick your code up on GitHub (so that I can clone it, run it on my machine and see the problem you are having) then I don’t mind taking a look.

Okay thank you

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.