Reputation: 41
So I want to use React to fetch blog posts from WordPress, but when I do so, all the styling is lost and I get only JSON plain text which is neither formated nor styles with h1, no images, and vice versa, what is the solution to this problem?
Upvotes: 0
Views: 415
Reputation: 522
Using graphql you can query enqueuedStylesheets over posts
query MyQuery {
posts {
nodes {
enqueuedStylesheets {
nodes {
src
}
}
}
}
}
And you can add styles to your react page with react-helmet.
<Helmet>
<link rel="stylesheet" type="text/css" href="style.css" />
</Helmet>
Upvotes: 1