Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update react typescript #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ or
First import the Pagination component inside
your React component.
```react
import {Pagination} from 'react-laravel-paginex'
import { Pagination } from 'react-laravel-paginex'
```

Then you'll be able to use pagination component.

#### Example:

```html
<Pagination changePage={this.getData} data={data}/>
<Pagination changePage={this.getData} data={data} />
```
`changePage` prop will run the function
( in our case is `getData()`) when new page selected.
##### getData() function example with axios.
```javascript
getData=(data)=>{
getData = (data) => {
axios.get('getDataEndpoint?page=' + data.page).then(response => {
this.setState({data:data});
});
Expand Down Expand Up @@ -112,7 +112,7 @@ numbersCountForShow | 2
activeClass | active

##### Example:
`<Pagination changePage={this.getData} data={data} containerClass={"pagination-container"}/>`
`<Pagination changePage={this.getData} data={data} containerClass={"pagination-container"} />`

You can use `options` prop by passing options object into it.

Expand All @@ -126,20 +126,21 @@ options:{
...
}
```
`<Pagination changePage={this.getData} data={data} options={options}/>`
`<Pagination changePage={this.getData} data={data} options={options} />`

##### Example:
You can set your own request params for request
```javascript
params=()=>{
params = () => {
return {
keyword:this.state.keyword
}
}
```
`<Pagination changePage={this.getData} data={data} options={options} requestParams={this.params()}/>`
`<Pagination changePage={this.getData} data={data} options={options} requestParams={this.params()} />`

## Credits

- [Garik Harutyunyan](https://github.com/GHarutyunyan)
- [Lionix Team](https://github.com/lionix-team)
- [Lionix Team](https://github.com/lionix-team)
- [Joe Prisk](https://github.com/jprisk)
Loading