Skip to content

Instantly share code, notes, and snippets.

Last active May 24, 2020 12:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Basic post navigation with React and the Wp Rest Api
import React, { useState, useEffect } from "react";
import Axios from "axios";
export default function App() {
// ...
return (
<div className="posts-app__wrapper">
<h1>Navigate Wp Rest Api Posts</h1>
<div className="posts-app__post-list">
{posts && posts.length &&, index) => {
return (
<div key={} className="posts-app__post">
<div dangerouslySetInnerHTML={{ __html: post.excerpt.rendered }} />
<a href={} target="_blank">Read post</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment