-1

This is my schema This is where I fetch the data This is the error

It can't find any reason why this wouldn't work. I have watched all tutorials doing the same. Any one have an idea?

2 Answers2

0

there is an extra braces in the query.

Write this:

const query = `*[_type == "courses"]{
                title
                }`;
sanityClient.fetch(query)
            .then(data=>setCourses(data))
0

Cannot thank you enough..just braces caused me 2 days..even tried another headless CMS..XD

Anurag
  • 11
  • 1