componentDidMount() {
const wordpressSiteUrl = 'http://projects.stagingsoftware.com/quacito_new/blog';
this.setState(stats: { loading: true }, callback: () => {
axios.get(url: `${wordpressSiteUrl}/wp-json/wp/v2/posts`)
});
}
I want wordpress blog fetch in react js but I’m unable that
2
Answers
This is the correct syntax:
You need to do it just like this. Just add curly brackets
{}
in setState and axios.