Unlock seamless workflows and faster delivery with our latest releases – get the details

Accessing a Sanity project in a React app using the JS client.

5 replies
Last updated: May 14, 2024
How can I access a sanity project, for which I have the ID and API token, in my React app?
May 13, 2024, 10:09 PM
You can either use the HTTP API to query your data or install the JS client, then configure it with your project ID and auth token. You will also need to add your dataset name in order for it to work.
May 13, 2024, 11:03 PM
Thanks for the reply! What do you mean by installing the JS client? Is there an example I can reference?
May 14, 2024, 1:18 AM
Yes, you can search the documentation and find a slew of examples!
May 14, 2024, 2:05 AM
For React, you'll want to install and run this package, specifically:
https://www.sanity.io/docs/js-client
May 14, 2024, 2:31 AM
Thanks so much!
May 14, 2024, 8:43 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?