I'm currently working on an airbnb clone and I wanted to start my local server through npm run dev and it gave me the following error. I'm sot sure why this morning everything was working perfectly but now it doesn't anymore even though I did not change or do anything. I searched online and people say the response might be html instead of json but how would that happen all of a sudden?? I also got a deployed version that you can access here https://airbnb-smoky-six.vercel.app https://airbnb-smoky-six.vercel.app It would be great if someone could guide me through fixing it.
The file refers to contains the following code:
import Head from 'next/head'
import Image from 'next/image'
import Header from '../Components/Header.js'
import Banner from '../Components/Banner.js'
import styles from '../styles/Home.module.css'
import SmallCard from '../Components/SmallCard.js'
import MediumCard from '../Components/MediumCard.js'
import LargeCard from '../Components/LargeCard.js'
import Footer from '../Components/Footer.js'
export default function Home({exploreData, cardsData}) {
return (
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</Head>
<Header />
<Banner />
<main className='max-w-6xl mx-auto px-12 sm:px-16'>
<section className='pt-6'>
<h2 className='text-4xl font-semibold pb-5'>Explore Nearby</h2>
{/* Pull name from a server - API endpoints */}
<div className='grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 '>
{exploreData?.map(({img, distance, location}) => (
<SmallCard
key={img}
img={img}
distance={distance}
location={location}
/>
))}
</div>
</section>
<section>
<h2 className='text-4xl font-semibold py-8'>Live Anywhere</h2>
{/* pull data from API endpoints */}
<div className='flex space-x-3 overflow-scroll scrollbar-hide p-3 -ml-3'>
{cardsData?.map(({ img, title }) => (
<MediumCard
key={img}
img={img}
title={title}
/>
))}
</div>
</section>
<section>
<LargeCard
img="https://links.papareact.com/4cj"
title="The Greatest Outdoors"
description="Wishlist curated by Airbnb"
buttonText="Get Inspired"
/>
</section>
</main>
<Footer />
</div>
)
}
export async function getStaticProps() {
const exploreData = await fetch('https://links.papareact.com/pyp')
.then (
(res) => res.json()
);
const cardsData = await fetch('https://links.papareact.com/zp1')
.then (
(res) => res.json()
);
return{
props: {
exploreData,
cardsData,
},
};
}
