An open API service indexing awesome lists of open source software.

https://github.com/guoyunhe/swr-pagination

Hook to connect SWR and Pagination components from Ant Design, Fusion Design, MUI, React Bootstrap, etc
https://github.com/guoyunhe/swr-pagination

Last synced: 3 months ago
JSON representation

Hook to connect SWR and Pagination components from Ant Design, Fusion Design, MUI, React Bootstrap, etc

Awesome Lists containing this project

README

        

# swr-pagination

SWR based pagination hook that connects RESTful API and Pagination components.

API adaptors for:

- Laravel (PHP)
- AdonisJS (Node.js)
- Rails (Ruby)
- DJango (Python)

UI adaptors for:

- Ant Design
- Fusion Design
- MUI (Material UI)

## Install

```bash
npm i swr swr-pagination
```

## Usage

```jsx
import { List, ListItem, ListItemText, Pagination } from '@mui/material';
import axios from 'axios';
import { SWRConfig } from 'swr';
import {
SWRPaginationConfigProvider,
laravelAdaptor,
mui5Adaptor,
useSWRPagination,
} from 'swr-pagination';

function App() {
return (
axios.get(url).then((res) => res.data),
}}
>




);
}

function PostList() {
const { data, paginationProps } = useSWRPagination('/posts');
return (



{data.map((item) => (



))}



);
}
```