2016-11-10 4 views
0

私はリアクションルータを学んでいますが、私はノードをサーバとして使用していません。私がやっていることは、XAMPPの/ htdocsにあるすべてのファイルをMacOSX上に置くことです。以前は、反応ルータを追加するまで、すべてのコードは問題ありませんでした。コンソールのエラー: 未知の型エラー:未定義のプロパティ 'getCurrentLocation'を読み取ることができません。リアクタルータの問題

次のようにサンプルコード:ここでは

//app.jsx 
import React from 'react'; 
import ReactDOM from 'react-dom'; 
import { Router, Route, hashHistory, IndexRoute} from 'react-router'; 
import App from './component/App.jsx'; 
import Home from './component/Home.jsx'; 
import Repos from './component/Repos.jsx'; 
import About from './component/About.jsx'; 
ReactDOM.render(
    <Router> 
     <Route path="/" component={App}> 
      <IndexRoute component={Home}/> 
      <Route path="/repos/:name" component={Repos} /> 
      <Route path="/about" component={About} /> 
    </Route> 
</Router>, 
document.getElementById('app') 
); 

は、私が表示され、私は輸入単一コンポーネント、単なる静的成分のいずれかをレンダリングする際には問題はありません私のWebPACKの設定

var config = { 
    entry: './index.jsx', 
    output: { 
    path: './', 
    filename: 'index.js' 
}, 
module: { 
    loaders: [ 
      { 
     test: /\.jsx?$/, 
     exclude: /node_modules/, 
     loader: 'babel', 

     query: { 
      presets: ['es2015', 'react'] 
     } 
     } 
    ] 
} 
} 
module.exports = config; 

ですこれらのうちの1つ:

//Home.jsx 
import React from 'react'; 
const Home =() => (
    <div>Home</div> 
); 
export default Home; 

この問題を解決するのに役立つ人はいますか?

私のために働いた
<Router history={browserHistory}> 

答えて

1
はにあなたを変更し

+0

ありがとう、私は追加し、それは動作します... –

関連する問題