2017-05-11 119 views
0

我在我的ReactJS應用程序中使用react-router。我正在嘗試使用react-router重定向特定路線。這裏是代碼:使用react-router重定向到路由

ReactDOM.render(
    <Router history={hashHistory}> 
     <Route component={ShowPost} path="/"></Route> 
     <Route component={AddPost} path="/addPost"></Route> 
    </Router>, 
    document.getElementById('app') 
); 

但我真的不知道如何以編程方式重定向到特定的路線。

回答