2

My app is using the react router

import React, { Component } from 'react';
import './App.css';
import Footer from './components/Footer'
import Header from './components/Header'
import Index from './components/Index'
import ContactForm from './components/ContactForm'
import ProjectPage from './components/ProjectPage'
import {
  BrowserRouter as Router,
  Route,
  Link
} from 'react-router-dom'

class App extends Component {
  render() {
    return (
    <Router>
        <div>
          <Header />
            <Route exact path='/' component={Index} />
            <Route exact path='/contact' component={ContactForm} />
            <Route exact path='/project' component={ProjectPage} />
        </div>

    </Router>
    );
  }
}

export default App;

When i use the regular heroku app and I am on the project or contact route, if a user refreshes the browser, the page will reload fine, but if they use my custom url, and refresh the page on that same route, the site will break to a 404. link examples https://agile-mesa-41419.herokuapp.com/ jdiperi.com

jdip88
  • 427
  • 2
  • 9
  • 23
  • add 404 route handler – Rei Dien Sep 26 '17 at 04:28
  • Possible duplicate of [React Routing works in local machine but not Heroku](https://stackoverflow.com/questions/41772411/react-routing-works-in-local-machine-but-not-heroku) – Panther Sep 26 '17 at 04:35
  • try to add a `static.json` or use build packs as mentioned in https://stackoverflow.com/questions/41772411/react-routing-works-in-local-machine-but-not-heroku – Panther Sep 26 '17 at 04:36
  • The heroku link works when i refresh on a react router route, but the custom url I assigned breaks when I refresh. – jdip88 Sep 26 '17 at 18:15

0 Answers0