iamPavan
iamPavan

Reputation: 275

How to specify the custom URL when i enter npm start in create-react-app

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

Upvotes: 3

Views: 2609

Answers (1)

Akram Badah
Akram Badah

Reputation: 427

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>

Upvotes: 4

Related Questions