javascript

Deploy React application from subdirectory

The code snippet shows how to deploy your React application from a sub-directory or folder

// OPEN  package.json FILE AND ADD "homepage": "/folder-name/"
{
    "name": "app name",
    "version": "0.1.0",
    ...
    "homepage": "/folder-name/" //ADD THIS AT THE BOTTOM
}

//OPEN ROUTING FILE AND ADD basename={'folder-name'}
<Router history={browserHistory} basename={'folder-name'}>
  <Route path="/" component={App} />
</Router>
Was this helpful?