-1
私はReact.jsを初めて使用しており、React.jsで少しのフィルタリングを使ってページ分割を実装しようとしています。サーバーからデータを取得した後、すべてのデータを一度に取得するのではなく、最大10個のデータを取得します。私はそれに何をどうやって接近するのかはわかりません。私はこれを読んでdocumentationとあなたがページネーションを実装することができますが、それを行う方法がわからないのだろうかと思う。また、文字「A」で始まり、ページネーションを使用する項目を検索する場合など、名前で項目をフィルタリングする方法はありますか?これまでに書いたコードです:改ページReact.jsを一度に10件ずつ
import React, { Component } from 'react';
import axios from 'axios';
import List from './List';
class Search extends Component {
constructor(props) {
super(props);
this.state = {
name: {
first: '',
last: ''
}
}
this.getName = this.getName.bind(this);
}
getName() {
axios.get('http://nameserver/people')
.then(res => res.json())
.then((response) => {
this.setState({
name: response.data
});
})
.catch((err) => {
console.log(err);
});
}
render() {
return (
<div >
<input placeholder='Search Name' />
<button onClick={this.getName}>Find</button>
<List first={this.state.name.first} last={this.state.name.last} />
</div>
);
}
}
export default Search;
私は助けていただきありがとうございます。ありがとう。