title: context.params.id gives error in nextjs. cannot define property 'id' of undefined
body: <p>I trying to fetch data from a json file(response.json), which is running in localhost:8000/response.json.
  Here is my code in pages/test.js:</p>
  <pre><code>import React from &quot;react&quot;;
  import Link from &quot;next/link&quot;;
  import Image from &quot;next/image&quot;;
  import Card from &quot;@material-ui/core/Card&quot;;
  import CardActions from &quot;@material-ui/core/CardActions&quot;;
  import CardContent from &quot;@material-ui/core/CardContent&quot;;
  import CardMedia from &quot;@material-ui/core/CardMedia&quot;;
  import Grid from &quot;@material-ui/core/Grid&quot;;
  import Typography from &quot;@material-ui/core/Typography&quot;;
  import { makeStyles } from &quot;@material-ui/core/styles&quot;;
  import Container from &quot;@material-ui/core/Container&quot;;
  import _ from &quot;lodash&quot;
  
  // components
  
  import Navbar from &quot;components/Navbars/AuthNavbar.js&quot;;
  import Footer from &quot;components/Footers/Footer.js&quot;;
  
  export const getStaticPaths = async () =&gt; {
    const res = await fetch(&quot;http://localhost:8000/response.json&quot;);
    const data = await res.json();
  
    const paths = data.data.map((gallery) =&gt; {
      return {
        params: { id: gallery.id },
      };
    });
  
    return {
      paths: paths,
      fallback: false,
    };
  };
  
  export const getStaticProps = async (context) =&gt; {
    
    const id = context.params.id;
    const res = await fetch(&quot;http://localhost:8000/response1.json&quot;);
    const data = await res.json();
    
    const thumbnail_ = data.data.filter(parentid =&gt; parentid.parent_id == id)
    return {
      props: { image_data: thumbnail_ },
    };
    
  };
  
  
  export default function Landing({ image_data }) {
      console.log(image_data)
      return (
      &lt;div&gt;
      &lt;/div&gt;
  );
  }
  </code></pre>
  <p>My response.json file:</p>
  <pre><code>{
      &quot;data&quot;: [
          {
              &quot;collection&quot;: null,
              &quot;id&quot;: 1,
              &quot;image_thumbanil&quot;: &quot;https://images.pexels.com/photos/434090/pexels-photo-434090.jpeg?auto=compress&amp;cs=tinysrgb&amp;dpr=1&amp;w=500&quot;,
              &quot;images_id&quot;: null,
              &quot;item&quot;: null,
              &quot;name&quot;: &quot;Animals&quot;,
              &quot;title&quot;: &quot;Animals&quot;
          },
          {
              &quot;collection&quot;: null,
              &quot;id&quot;: 2,
              &quot;image_thumbanil&quot;: &quot;https://images.pexels.com/photos/5703286/pexels-photo-5703286.jpeg?auto=compress&amp;cs=tinysrgb&amp;dpr=1&amp;w=500&quot;,
              &quot;images_id&quot;: null,
              &quot;item&quot;: null,
              &quot;name&quot;: &quot;Birds&quot;,
              &quot;title&quot;: &quot;Birds&quot;
          },
          {
              &quot;collection&quot;: null,
              &quot;id&quot;: 3,
              &quot;image_thumbanil&quot;: &quot;https://images.pexels.com/photos/3802510/pexels-photo-3802510.jpeg?auto=compress&amp;cs=tinysrgb&amp;dpr=1&amp;w=500&quot;,
              &quot;images_id&quot;: null,
              &quot;item&quot;: null,
              &quot;name&quot;: &quot;Car&quot;,
              &quot;title&quot;: &quot;Cars&quot;
          },
          {
              &quot;collection&quot;: null,
              &quot;id&quot;: 4,
              &quot;image_thumbanil&quot;: &quot;https://images.pexels.com/photos/40904/bmw-k-1300-metallic-motorcycle-40904.jpeg?auto=compress&amp;cs=tinysrgb&amp;dpr=1&amp;w=500&quot;,
              &quot;images_id&quot;: null,
              &quot;item&quot;: null,
              &quot;name&quot;: &quot;Bikes&quot;,
              &quot;title&quot;: &quot;Bikes&quot;
          },
          {
              &quot;collection&quot;: null,
              &quot;id&quot;: 5,
              &quot;image_thumbanil&quot;: &quot;https://images.pexels.com/photos/3220368/pexels-photo-3220368.jpeg?auto=compress&amp;cs=tinysrgb&amp;dpr=1&amp;w=500&quot;,
              &quot;images_id&quot;: null,
              &quot;item&quot;: null,
              &quot;name&quot;: &quot;Fishes&quot;,
              &quot;title&quot;: &quot;Fishes&quot;
          },
          {
              &quot;collection&quot;: null,
              &quot;id&quot;: 6,
              &quot;image_thumbanil&quot;: &quot;https://images.pexels.com/photos/1040880/pexels-photo-1040880.jpeg?auto=compress&amp;cs=tinysrgb&amp;dpr=1&amp;w=500&quot;,
              &quot;images_id&quot;: null,
              &quot;item&quot;: null,
              &quot;name&quot;: &quot;Actors&quot;,
              &quot;title&quot;: &quot;Actors&quot;
          },
          {
              &quot;collection&quot;: null,
              &quot;id&quot;: 7,
              &quot;image_thumbanil&quot;: &quot;https://images.pexels.com/photos/6896193/pexels-photo-6896193.jpeg?auto=compress&amp;cs=tinysrgb&amp;dpr=1&amp;w=500&quot;,
              &quot;images_id&quot;: null,
              &quot;item&quot;: null,
              &quot;name&quot;: &quot;Actresses&quot;,
              &quot;title&quot;: &quot;Actresses&quot;
          },
          {
              &quot;collection&quot;: null,
              &quot;id&quot;: 8,
              &quot;image_thumbanil&quot;: &quot;https://images.pexels.com/photos/37859/sailing-ship-vessel-boat-sea-37859.jpeg?auto=compress&amp;cs=tinysrgb&amp;dpr=1&amp;w=500&quot;,
              &quot;images_id&quot;: null,
              &quot;item&quot;: null,
              &quot;name&quot;: &quot;Ships&quot;,
              &quot;title&quot;: &quot;Ships&quot;
          }
      ]
  }
  </code></pre>
  <p>The error is get is:
  TypeError: Cannot read property 'id' of undefined
  <a href="https://i.stack.imgur.com/OHqZz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OHqZz.png" alt="error display in browser" /></a></p>
  <p>My goal is to display images with parent_id = 1, I want that id to increment by one for every time the program runs. For eg.) when I run the next app, I want to get display items with parent_id = 1 and then 2 and so on..</p>