Routes not working when react app is build

gihanrangana

GihanRangana

Posted on August 17, 2018

Routes not working when react app is build

I created react app react router 4.but I build my project using npm run build route URL not working and display 404 page.how can I fix that? I have no idea.this is my code

import React from "react";
import ReactDOM from "react-dom";
import registerServiceWorker from "./registerServiceWorker";
import { BrowserRouter as Router,Switch,Route } from "react-router-dom";

import { createMuiTheme, MuiThemeProvider } from "@material-ui/core/styles";

import "react-datepicker/dist/react-datepicker-cssmodules.css";
import "./styles/main.scss";


import App from "../App";
import AdminHome from "../pages/admin/home";
import Login from "../pages/login";
import PrivateRoute from "./privateRoute";

const theme = createMuiTheme({
    palette: {
        type: "dark"
    }
});

ReactDOM.render((

Not Found

}/> ), document.getElementById("root")); registerServiceWorker();

Can anyone help me to fix this?

πŸ’– πŸ’ͺ πŸ™… 🚩
gihanrangana
GihanRangana

Posted on August 17, 2018

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related