0
私はreact-routerとreduxでページネーションを作ろうとしています。 状況を簡素化するために、私は改ページを削除し、Newsコンポーネントのみを残しました。 私は同じ問題があります。私がボタンを押すと経路が経路に追加されます。パスは 'http://localhost:3000/news/page/news/page/news/page/4'のようになります。反応ルータ2.8置換の代わりにパスを追加するリンク
import React, { Component } from 'react'
import { Link } from 'react-router'
export default class News extends Component {
render() {
let nextPage = + (this.props.params.page || 1);
return(
<div>
<h1>I am on {nextPage}</h1>
<ul>
<li><Link to='news/page/2'>Page2</Link></li>
<li><Link to='news/page/3'>Page3</Link></li>
<li><Link to='news/page/4'>Page4</Link></li>
</ul>
</div>
)
}}
export const routes = (
<div>
<Route path='/' component={App}>
<IndexRoute component={Home}/>
{/*}<IndexRedirect to='list' />*/}
<Route path='/news(/page/:page)' component={News}/>
<Route path='/admin' component={Admin} onEnter={Admin.onEnter}/>
<Route path='products' component={Products}/>
<Route path='contacts' component={Contacts}/>
<Route path='about' component={About} />
<Route path='login' component={LoginPage} />
<Route path='orders' component= {Orders}/>
<Route path='signup' component={SignupPage}/>
<Route path='validateEmail' component= {requireIdentification(ValidateEmail)}/>
<Route path='/verifyEmail/:token' component={CheckEmail}/>
</Route>
<Route path='*' component={NotFound} />
</div>
)