1
を反応にエラーが定義されていない:私は「/賃金」に移動しようとすると、いくつかの理由リンクは、私は次のコードでアプリを反応させる必要があり、ルータ
import { Link } from 'react-router';
var Matches = React.createClass({
contextTypes: {
router: React.PropTypes.object
},
...
componentWillMount: function() {
var router = this.context.router;
...
router.push('/pay');
}
});
、私は次の例外を取得:
"Uncaught ReferenceError: Link is not defined"
私のルートは、次のように定義されています
var auth_and_info_check = function auth_and_info_check(nextState, replace, callback) {
if (!_horizon_connect2.default.hasAuthToken() && !nextState.location.pathname.endsWith("login")) {
replace({ pathname: '/login' });
callback();
} else if (_horizon_connect2.default.hasAuthToken() && nextState.location.pathname.endsWith("/")) {
_horizon_connect2.default.currentUser().fetch().subscribe(function (user) {
if (!(user.hasOwnProperty('data') && user.data.hasOwnProperty('phone'))) {
replace({ pathname: '/user_info' });
callback();
} else {
callback();
}
});
} else {
callback(); //In my case after routing "/pay" I call this callback
}
};
<Router history={hashHistory}>
<Route component={Layout}>
...
<Route path="/pay" component={Pay} onEnter={auth_and_info_check}/>
...
</Router>
</Router>
あなたは私が間違っているの何のアイデアを持っていますか? '反応-ルータ-DOM' から
正常に動作していますか? – 1ven
Link自身のインポートが機能していないように見えます。あなたのコードのどこでもそれを使用していますか? – KumarM
あなたのビルドファイルを見る必要があるようです。リンクがあなたの最終的なjsファイルに含まれていることを二重に確認していない限り、それが問題です。質問に追加情報として追加することもできます。 – KumarM