title: Uncaught Type Error: recipes .map is not a function. I am trying to map my data
body: <p>This is my Recipe List file, I am trying to map my recipe fetched data in it, I will give my recipe MongoDB schema if that would help. My recipe Model has only the html for how the card would look like, and I am passing the recipe prop of course.</p>
  <p>I am new to React.js. I don't know how to fix.</p>
  <pre><code>import &quot;./RecipeList.css&quot;;
  import { Link, NavLink } from 'react-router-dom';
  import React, { useEffect, useLayoutEffect, useState } from 'react';
  import RecipeModel from &quot;../Recipe/RecipeModel/RecipeModel&quot;;
  
  const RecipeList = () =&gt; {
      
      const [recipes,setRecipes] = useState([]);
  
      useEffect(() =&gt; {
          fetch('http://localhost:3005/api/recipes?page=1&amp;limit=10')
          .then(res =&gt; res.json())
          .then(result =&gt; {
              setRecipes(result)
          });
      },[]);
  
      // useLayoutEffect(() =&gt; {
      //     window.scrollTo(0, 0)
      // });
  
     
      return (
          &lt;div&gt;
             &lt;section className=&quot;sec4&quot;&gt;
             &lt;h1&gt;Caponata pasta&lt;/h1&gt;
             {recipes.map(x=&gt; &lt;RecipeModel key ={x._id} recipe={x}/&gt;)}
      &lt;/section&gt;
      &lt;section className=&quot;sec5nav&quot;&gt;
      &lt;ul&gt;
              &lt;li&gt;&lt;Link smooth= &quot;true&quot; to=&quot;/&quot;&gt;&lt;i className=&quot;fas fa-solid fa-book-bookmark&quot;&gt;&lt;/i&gt;&lt;/Link&gt;Home&lt;/li&gt;
              &lt;li&gt;&lt;Link smooth= &quot;true&quot; to=&quot;/recipes&quot;&gt;&lt;i className=&quot;fas fa-thin fa-bowl-rice&quot;&gt;&lt;/i&gt;&lt;/Link&gt;Recipes&lt;/li&gt;
              &lt;li&gt;&lt;Link smooth= &quot;true&quot; to=&quot;/personal-list&quot;&gt;&lt;i className=&quot;fas fa-solid fa-list-ul&quot;&gt;&lt;/i&gt;&lt;/Link&gt;Your Recipes&lt;/li&gt;
              &lt;li&gt;&lt;Link smooth= &quot;true&quot; to=&quot;/favourites&quot;&gt;&lt;i className=&quot;fa-solid fa-heart&quot;&gt;&lt;/i&gt;&lt;/Link&gt;Favourites&lt;/li&gt;
              &lt;li&gt;&lt;Link smooth= &quot;true&quot; to=&quot;/create-recipe&quot;&gt;&lt;i className=&quot;fas fa-solid fa-plus&quot;&gt;&lt;/i&gt;&lt;/Link&gt;Add Recipe&lt;/li&gt;
              &lt;li&gt;&lt;Link smooth= &quot;true&quot; to=&quot;/user-profile&quot;&gt;&lt;i className=&quot;fas fa-solid fa-user&quot;&gt;&lt;/i&gt;&lt;/Link&gt;Your Profile&lt;/li&gt;
          &lt;/ul&gt;
          &lt;a href=&quot;#&quot; className=&quot;to-top&quot; id =&quot;to-top&quot;&gt;
      &lt;i className=&quot;fas fa-chevron-up&quot;&gt;&lt;/i&gt;
    &lt;/a&gt;
          &lt;/section&gt;
          &lt;/div&gt;
      );
  }
  
  export default RecipeList;
  </code></pre>
  <p>This is my Recipe Model, my recipe schema for Mongo Db</p>
  <pre><code>    const { Schema, model } = require('mongoose');
  
  const recipeSchema = new Schema(
      {
        name: {
          type: String,
          required: true,
          minLength: [2, 'Name should be at least 5 characters long!'],
        },
        time: {
          type: String,
          required: true,
          minLength: [2, 'Time should be in the format(10min)!'],
        },
        imageUrl: {
          type: String,
          required: true,
          match: [/^https?:\/\/.+/, 'ImageUrl is not valid!'],
        },
        ingredients: {
          type: String,
          required: true,
          minLength: [5, 'Ingredients should be at least 5 characters long!'],
        },
        instructions: {
          type: String,
          required: true,
          minLength: [10, 'Instructions should be at least 10 characters long!'],
        },
        isDeleted: {
          type: Boolean,
          default: false,
        },
      },
      { timestamps: true }
    );
    
    const recipeModel = model('Recipe', recipeSchema);
    module.exports = {
      recipeModel,
    };
  </code></pre>
  <p>This is the console screenshot:
  <a href="https://i.stack.imgur.com/v9HiQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v9HiQ.png" alt="enter image description here" /></a></p>