September 2018
Beginner
156 pages
3h 28m
English
The basename prop is used to provide a base URL path for all the locations in the application. For example, if you want to render your application at the /admin path instead of rendering at the root path /, then specify the basename prop in <BrowserRouter>:
<BrowserRouter basename="/admin"> <App /></BrowerRouter>
The basename prop now adds the base URL path /admin to the application. When you navigate using <Link> and <NavLink>, the basename path is added to the URL. For example, consider the following code with two <Link> components:
<BrowserRouter basename="/admin"> <div className="component"> <nav> <Link to="/">Home</Link> <Link to="/dashboard">Dashboard</Link> </nav> </div></BrowserRouter>
When you click on the Home link ...
Read now
Unlock full access