I'm trying to make an API request and display them, I think that I have to render them as array but have problems with this. Here is my code
class RecipesList extends React.Component {
constructor(props) {
super(props);
this.state = {
searchResult: ''
};
}
componentDidMount() {
fetch('https://api.edamam.com/search?q=chicken&app_id=ec279fce&app_key=51017bcd32e69bcb0cc8b5f99e8783ca')
.then(resp => resp.json())
.then(resp => this.setState({searchResult: resp})
);
}
render() {
return <div>{this.state.searchResult}</div> //???
}
}
class App extends React.Component {
render() {
return <RecipesList/>;
}
}
ReactDOM.render(
<App/>, document.querySelector('#app'));
searchResultdata that you are getting in api response ?