Ajax Request in React js
Copy Below Code
View As A Text File
Show Text Only
Show API
Edit Code
async componentDidMount() {
const url = 'http://localhost:8000/api/getHomePageContent';
const response = await fetch(url);
const output = await response.json();
this.setState({data:output});
console.log(output);
}