2

我的应用正在使用反应路由器

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;

当我使用常规 heroku 应用程序并且我在项目或联系人路由上时,如果用户刷新浏览器,页面将重新加载正常,但如果他们使用我的自定义 url,并在同一条路由上刷新页面,网站将中断为 404. 链接示例 https://agile-mesa-41419.herokuapp.com/ jdiperi.com

4

0 回答 0