2016-06-18 9 views
6

burada tarayıcı geçmişini kullanarak ve olduğum bir navigasyon yapmak için ('/') routes.js"yönlendirici artık tarih geçmişini karma geçmişi için varsayılan değil" uyarısı nasıl giderilir?

export default (
    <Router history={browserHistory}> 
    <Route path="/" component={Main}> 
     <Route path="home/:username" component={Home}> 
     <IndexRoute component={HomeContent}></IndexRoute> 
     <Route path="widget/:second" component={Widget}></Route> 
     <Route path="email/:second" component={Email}> 
      <Route path="compose" component={ComposeEmail}></Route> 
      <IndexRoute component={CheckEmail}></IndexRoute> 
     </Route> 
     <Route path="social/:second" component={Social}></Route> 
     <Route path="calendar/:second" component={Calendar}></Route> 
     </Route> 
     <IndexRoute component={Login}></IndexRoute> 
    </Route> 
    </Router> 
); 

benim kodudur ve ben this.context.router.push kullandı. ve bu uyarının neden konsolumda gösterilmediğine dair hiçbir fikrim yok?

"Warning: [react-router] `Router` no longer defaults the history prop to hash history. Please use the `hashHistory` singleton instead." 

zaten https://github.com/reactjs/react-router/blob/master/upgrade-guides/v2.0.0.md#no-default-history adresinden belgeleri okumak ama gerçekten yardımcı olmuyor.

i herhangi bir yardım :) yerine browserHistory ait hashHistory kullanmak gerekir

+0

Bu kod snippet'ini "import" veya "react-router" için "require" ifadesini içerecek şekilde güncelleştirir misiniz? – sighrobot

cevap

0

takdir. import synthax'ı kullandığınız düşünüldüğünde, browserHistory'u değiştirmek için react-router'dan hashHistory'u alabilirsiniz.

import { hashHistory, Router, ... } from 'react-router'; 

const history = new hashHistory(); 

export default (
    <Router history={history}> 
    ... 
    </Router> 
); 
İlgili konular