I am trying to do an API call and then display that information from the API call. For some reason even though the data is stored, it wont display on the page.
In APP.js I have {results.length != 0 && <Recipe items={results} />} where results is an array full of recipe information. Then I do an API call and store the results in the results state variable using setResults. This is my code for my recipe component
import Nutrients from "./Nutrients";
const Recipe = ({ items }) => {
return (
<div>
Items should be mapped
{items &&
items.map((item) => {
const { id, title, image, nutrition } = item;
console.log("id " + id);
const { nutrients } = nutrition;
console.log(nutrients);
<p>map</p>;
})}
</div>
);
};
export default Recipe;
My component for recipe displays the "items should be mapped" but it does not display the mapping of the items. Any idea why?