반응 라우터 v4를 사용하기 시작했습니다. 내 탐색 링크가있는 내 app.js에 간단한 <Router>
이 있습니다 (아래 코드 참조). localhost/vocabulary
으로 이동하면 라우터가 나를 올바른 페이지로 리디렉션합니다. 그러나 나중에 다시로드 (F5)를 누르면 (localhost/vocabulary
) 모든 콘텐츠가 사라지고 브라우저 보고서 Cannot GET /vocabulary
이 표시됩니다. 어떻게 가능합니까? 누군가가 그 문제를 해결할 수있는 단서를 제공 할 수 있습니까?React-router v4 - GET * url *
App.js :
import React from 'react'
import ReactDOM from 'react-dom'
import { BrowserRouter as Router, Route, Link } from 'react-router-dom'
import { Switch, Redirect } from 'react-router'
import Login from './pages/Login'
import Vocabulary from './pages/Vocabulary'
const appContainer = document.getElementById('app')
ReactDOM.render(
<Router>
<div>
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to="/vocabulary">Vocabulary</Link></li>
</ul>
<Switch>
<Route exact path="/" component={Login} />
<Route exact path="/vocabulary" component={Vocabulary} />
</Switch>
</div>
</Router>,
appContainer)
가능한 중복 /index.html를하는 폴백합니다 [반작용 라우터 URL이 작동하지 않는 경우 새로 고침 또는 수동을 writting] (http://stackoverflow.com/questions/27928372/ 수동으로 새로 고침 또는 작업 중일 때 반응 라우터 URI가 작동하지 않음) – Chris