私の問題はReact router appending query to URLに似ているが、私は、私は歴史から追加の余分なクエリのparamを除外することができますどのように、スイッチとroutes.In私の場合で、ルータ4を反応させる使用していますか?リアクトルータ4余分なクエリのparam追加
render(){
return(
<div>
<Header/>
<Switch>
<Route exact path="/" render={(props) => (<Home passDealsToRoute ={this.dealsCallBack} {...props}/>)}/>
<Route exact path="/mall/:id/:store_id/:deal_id" render={(props) => (<MallDetail deals ={this.deals} {...props}/>)}/>
<Route exact path="/mall/:id/:store_id" render={(props) => (<MallDetail deals ={this.deals} {...props}/>)}/>
<Route exact path="/mall/:id" render={(props) => (<MallDetail deals ={this.deals} {...props}/>)}/>
<Route path="/home/:location" render={(props) => (<Home passDealsToRoute ={this.dealsCallBack} {...props}/>)} />
<Route exact path="/about" component={About}/>
</Switch>
<Footer/>
</div>
);}} export default withRouter(Root);
私のインデックスファイル
import React from 'react';
import {BrowserRouter,Route} from 'react-router-dom';
import {render} from 'react-dom';
import Root from './components/root/root';
import { createBrowserHistory } from 'history';
const history = createBrowserHistory({queryKey: false});
class App extends React.Component {
render() {
return(
<BrowserRouter history={history}>
<Route path={"/"} component={Root}/>
</BrowserRouter>
);
}
};
render(<App/>,window.document.getElementById('app'));
のでmuch.I'veはそれを追加それはまだすべてのAPIコールで、余分なクエリのparamを渡していただきありがとうございます。 &_ = 1505635138301。インデックスファイルを追加しました。 –
あなたの答えは私にreact.Thanksトンのルータ&歴史概念を理解するためにたくさん助けtrue.Anyhowキャッシュを追加することにより、固定:) –