Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Tips for fetching data with Sanity v3 in a React project

6 replies
Last updated: Jun 13, 2023
Good evening! I just took the step to work with v3 instead of v2, and got a studio up and running etc. I’m just now trying to find information how to go about fetching the data with v3. Can you use sanityClient or what do I use instead? I’ve been following Kapehe’s NEXT+Sanity-guide and some launch vids, but can’t find the right one. I’m working with React, no TS and no Next. Does anyone have tips on what articles to read or vids to watch to get a grip on the fetch-part I’d be very happy! Thanks in advance. ☺️
Jun 11, 2023, 8:45 PM
You can also just use the built in fetch web API and fetch data from sanity using their HTTP API: https://www.sanity.io/docs/http-api
Jun 11, 2023, 8:54 PM
Thanks! I think the first link was it. But I feel so stupid, i get this error when trying to import the function to one of my components.
Module not found: Error: Can't resolve '@sanity.config' in '/Users...
Jun 11, 2023, 9:09 PM
Am I missing something?
Jun 11, 2023, 9:09 PM
Clearly was. Working now. Thanks for the help
user R
🥳
Jun 11, 2023, 9:28 PM
Sweet! Don't feel too stupid. About 90% of the things I ask here I end up figuring out like 5 minutes later. 😁
Jun 13, 2023, 6:54 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?