In my localhost testing environment, the URL "http://127.0.0.1:5173/mike/1/1/103" directs to the first route path and the params are read as expected. However in my deployed environment at "https://app-name.vercel.app/" if I have any text after ".app/" I'm getting a 404 error. If I remove the text after "app./" then it directs to this route:
<Redirect from="/" exact to="/mike" component={Stats} />
Here is my full code. I'm using an older version of react-router-dom (version 5.1.2).
import { useState } from "react";
import { BrowserRouter, Switch, Route, Redirect } from "react-router-dom";
import "./App.css";
import Stats from "./components/stats";
import NotFound from "./components/notFound";
function App() {
const [count, setCount] = useState(0);
return (
<div>
<main className="container">
<BrowserRouter>
<Switch>
<Route path="/:username/:win/:loss/:draw" component={Stats} />
<Route path="/:username" component={Stats} />
<Redirect from="/" exact to="/mike" component={Stats} />
<Redirect to="/not-found" component={NotFound} />
</Switch>
</BrowserRouter>
</main>
</div>
);
}
export default App;