Last active
April 15, 2024 10:45
-
-
Save vanaf1979/5c649a17d63a29e2df3cd3e587cc284b to your computer and use it in GitHub Desktop.
Fixing and Parsing WordPress Rest Api content in React. https://since1979.dev/fixing-and-parsing-wordpress-rest-api-content-in-react/
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"; | |
import parse from "html-react-parser"; | |
export default function App() { | |
// ... | |
return ( | |
<div className="App"> | |
{post && ( | |
<div> | |
<h1>{post.title.rendered}</h1> | |
{parse(post.content.rendered)} | |
</div> | |
)} | |
</div> | |
); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment