Created
November 9, 2019 23:42
-
-
Save oquirozm/7a4e976d239d453706b16d1d737d1672 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react'; | |
function usePagination() { | |
const [page, setPage] = useState(1); | |
const nextPage = () => setPage(page + 1); | |
const prevPage = () => setPage(page - 1); | |
return { page, setters: { prevPage, nextPage } }; | |
} | |
export default usePagination; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment