Last active
May 24, 2020 12:41
-
-
Save vanaf1979/5325a7db2918cb3a005cce187097360e to your computer and use it in GitHub Desktop.
Basic post navigation with React and the Wp Rest Api https://since1979.dev/basic-post-navigation-with-react-and-the-wp-rest-api/
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 React, { useState, useEffect } from "react"; | |
import Axios from "axios"; | |
export default function App() { | |
// ... | |
const handlePrevPage = () => setPage(page - 1 ? page - 1 : 1); | |
const handleNextPage = () => setPage(page < nrofpages ? page + 1 : nrofpages); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment