2016-03-25 15 views
2

renderToStringを使用してコンポーネントをサーバー側でレンダリングします。そのすべてがうまくいきます。/registerのようなURLを手動で入力すると、コンポーネントが完全にレンダリングされます。状態にリンクしてもURLは変更されません

問題は、私のアプリケーションで<Link>を使用しているとき、状態は変化していますが、私のURLはまったく更新していません。

route.js:

import React from 'react'; 
import { render } from 'react-dom'; 
import { Provider } from 'react-redux'; 
import { browserHistory, Router, match } from 'react-router'; 
import routes from './routes'; 
import store from './stores'; 

// Server rendering works identically when using async routes. 
// However, the client-side rendering needs to be a little different 
// to make sure all of the async behavior has been resolved before the 
// initial render,to avoid a mismatch between the server rendered and client rendered markup. 

match({ location:browserHistory, routes }, (error, redirectLocation, renderProps) => { 
    render((
    <Provider store={store}> 
     <Router {...renderProps} /> 
    </Provider> 
), document.getElementById('root')); 
}); 

私はそれがbrowserHistoryに起因する可能性が感じている、私は欠けている何かがあるのでしょうか?

答えて

2

私はmatch()に間違った引数を与えていました。代わりに:

match({ location:browserHistory, routes } 

それはされている必要があります。

match({ history:browserHistory, routes } 
関連する問題