3

I wanted to load custom URL when i load the react using npm start in create-react-app. By default it will open localhost:somePort/. But i need locahost:somePort/somestuff

iamPavan
  • 255
  • 4
  • 15

1 Answers1

4

How about just redirect from you app.js to the path you want? Like this:

import { BrowserRouter, Route, Redirect } from 'react-router-dom'

<BrowserRouter>
   <Switch>
     <Route
        path='/'
        component={SomeComponent}
     />
     <Redirect to='/somestuff'/>
   </Switch>
</BrowserRouter>
Akram Badah
  • 417
  • 3
  • 12