0

In my React project, the routing is performed by React Router. The thing is when this is supposed to handle different routes, the 404.html shows up instead. For my specific case

<BrowserRouter>
            <Routes>
                <Route path="/" element={user ? <Home /> : <SignIn />} />
                <Route
                    path="/upload"
                    element={user ? <Upload /> : <SignIn />}
                />
                <Route path="/chat" element={user ? <Chat /> : <SignIn />} />
                <Route
                    path="/settings"
                    element={user ? <Settings /> : <SignIn />}
                />
            </Routes>
</BrowserRouter>

The following is how I am handling Routes. It works on localhost but it doesn't work after Netlify build deploy.

Please do look at this link

If you want to look at the entire code, you can find it here

The Home page works fine, but the chat, settings and upload routes are being blocked by some cause.

Konrad
  • 21,590
  • 4
  • 28
  • 64
Muneeb
  • 69
  • 7
  • Does this answer your question? [Netlify renders 404 on page refresh (using React and react-router)](https://stackoverflow.com/questions/58065603/netlify-renders-404-on-page-refresh-using-react-and-react-router) – Konrad Oct 16 '22 at 18:40
  • Evidently you haven't configured pushstate fallback routing correctly. – jonrsharpe Oct 16 '22 at 18:41

0 Answers0