So I have an issue where I am using conditional routing in an assignment and for some reason it's not returning the expected value so here is what the important part of the code looks like:
<Route
path="/profile/:username?"
element={<Profile />}
/>
However running like this keeps giving me an error that it couldn't find the page. When I checked out the useParams I found that instead of labeling the conditional username it would label it "*" and then have the full path in the output like this:
*:'/profile/dsamuelson'
yet when I take the question mark off then it labels the path correctly as username and gives me the page I want
username:'dsamuelson'
Does anyone have any idea why it's behaving like that. Literally every page I go to says that all you do is add the ? mark conditional lookback and it should work with or without the second field but it is just not working. Any help is greatly appreciated.