Hi there,
I’m in the process of using Frontity to re-do my site in React.
My old site is a Wordpress site and I really only want to continue using it as a CMS for storing the many previously uploaded images.
I’m having trouble understanding how I would go about using the Wordpress REST API to access these images
So in my frontity.settings.js
file I have
{
name: "@frontity/wp-source",
state: {
source: {
api: "https://www.scramblelock.com/wp-json",
},
},
},
and I am creating a Navigation component wherein I want to fetch the image of my logo.
I can make a Postman call to get the image object with this
http://www.scramblelock.com/wp-json/wp/v2/media/10325
I just dont know how to integrate it into my Navigation component, which currently includes:
const Navigation = () => {
return (
<nav>
<Image src={<image object's .link attribute to go here>} alt="" />
<Link link="/">Home</Link>
<Link link="/about">About</Link>
<Link link="/services">Services</Link>
<Link link="/contact">Contact</Link>
</nav>
)
}
I’ve seen some previous posts that talk about using actions.source.fetch()
within a useEffect
within the component, and others that do beforeSSR
calls in the top most index.js
file but it’s getting super confusing
It would help to know what exactly is needed here to fetch this particular image and have it displayed in my component as clear and concise as possible. Thank you!