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
- Host: GitHub
- URL: https://github.com/guoyunhe/swr-pagination
- Owner: guoyunhe
- License: mit
- Created: 2023-06-20T07:40:00.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-21T15:36:40.000Z (almost 2 years ago)
- Last Synced: 2025-02-12T09:57:48.416Z (4 months ago)
- Language: TypeScript
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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) => (
))}
);
}
```