I'm getting the error message:
Uncaught TypeError: _sanity_client__WEBPACK_IMPORTED_MODULE_2___default(...).fetch is not a function
I can't figure out why. Its referencing line about.js:11:1
which is the sanityClient
line, but when any changes I make to it hasn't worked. Here's my code:
import React, { useState, useEffect }from 'react';
import './about.css'
import sanityClient from "@sanity/client";
export default function About() {
const [aboutData, setAbout] = useState(null);
useEffect(() => {
sanityClient
.fetch(`*[_type=="website_images"]{
alt,
about{
asset->{
_id,
url
}
}
}`)
.then((data) => setAbout(data))
.catch(console.error);
}, [] );
return (
<main className="main-about">
<div className="about-body">
<div className="about-title">
<div className="title-line-left"></div>
<h2>about</h2>
<div className="title-line-right"></div>
</div>
<div className="about-text">
<p className="pronouns">(they/them)</p>
<p>The Japanese city and the Prefecture of Hiroshima may have been devastated by the atomic bomb over 76 years ago, but today, this site of the destruction is one of the top tourist destinations in the entire country. Statistics released by the nation's tourist agency revealed that around 363,000 visitors went to the metropolis during 2012, with Americans making up the vast majority of that figure, followed by Australians and Chinese.</p>
</div>
</div>
{aboutData && aboutData.map((website_images, index) => (
<figure className="photo-position">
<img src="{website_images.about.asset.url" alt="website_images.alt" className="about-photo"></img>
</figure>
))}
</main>
)
}