You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently if the basename prop is provided for BrowserRouter(or HashRouter), the routes only render if the url matches the complete url with basename.
Suppose you have a BrowserRouter like this:-
The Home element will only render if the path is "/app" otherwise it will render nothing. You can add custom logic to redirect to "/app" if the provided url matches no route. But the basename will be more useful if there is an auto redirection for requests that hit "/". It should redirect to "/app" in such case that a basename prop is used.
There should be at least an option to use auto redirect or not.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Currently if the basename prop is provided for BrowserRouter(or HashRouter), the routes only render if the url matches the complete url with basename.
Suppose you have a BrowserRouter like this:-
The Home element will only render if the path is "/app" otherwise it will render nothing. You can add custom logic to redirect to "/app" if the provided url matches no route. But the basename will be more useful if there is an auto redirection for requests that hit "/". It should redirect to "/app" in such case that a basename prop is used.
There should be at least an option to use auto redirect or not.
Beta Was this translation helpful? Give feedback.
All reactions