2016-10-14 6 views
0
//startup file 
import {BrowserRouter} from 'react-router'; 
let root=(<BrowserRouter> 
      //Some components 
     </BrowserRouter>);                 
ReactDOM.render(Root, document.getElementById("app"));  

// function to navigate or route 
import createBrowserHistory from 'history lib createBrowserHistor'; 
const history = createBrowserHistory(); 

let browseTo=function(path){ 
    history.push({pathname: path}) 
}) 

위 함수를 호출 한 후 실제 경로가 변경되는 실제 경로는 수행되지 않습니다.BrowserRouter를 사용할 때 history.push가 작동하지 않습니다.

마찬가지로 URL localhost:8080localhost:8080/login으로 변경되어 로그인 구성 요소로 라우팅되지 않습니다.

답변