score:0
you should also create token and pass the token:
import sanityclient from '@sanity/client'
export const client = sanityclient({
projectid: 'projectid',
dataset: 'production',
apiversion: '2021-03-25',
token: 'click api tab and add new token',
usecdn: false,
})
score:1
you can specify an api version when you configure your client:
import sanityclient from "@sanity/client";
export default sanityclient({
projectid: "myprojectid",
dataset: "production",
usecdn: true,
apiversion: "2022-02-03"
});
it's best to hard code your api version to the date you implement it. that way, it's guaranteed to work as you expect. if you were to use a javascript date to always return whatever today is, a breaking change could be put in place that causes the client to no longer work. there are a few more details in the documentation here.
Source: stackoverflow.com
Related Query
- Using the Sanity client without specifying an API version is deprecated
- Is it wrong to fetch an API without using the useEffect Hook?
- How can I crop an image on the client side without losing resolution using React
- What's the Idiomatic way for using custom api client across react components?
- How to get all query params using React-Router-DOM v6 `useSearchParams` without specifying the key?
- Please I'm using fetch to get data from an API, but only the JSX return without the products. Api is from: http://fakestoreapi.com/docs
- Is there a way to add a Response Header for `X-Total-Count` in the client in React Admin ? Without sending the header from the API
- Sort API Response without Storing the Data using JavaScript
- Can I call the Twitter API in client using Fetch?
- I am trying to make an API request based on the result of another API request using forEach. How I could archive the same result without using forEach
- Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema
- Invalid options object. Dev Server has been initialized using an options object that does not match the API schema
- Can I use webpack on the client side without nodejs server?
- React - Changing the state without using setState: Must avoid it?
- How to override styles for material-ui TextField component without using the MUIThemeProvider?
- How to use React's BrowserRouter on client and Java REST API (Spring Boot) on the server?
- How to import uikit js in react js without using the uikit component?
- How to make the API call and display it in React JS using React Table and Axios?
- Can we use Calender component in the material UI picker as a standalone component without using the Datepicker - if so How?
- Invoke Lambda function from Amplify-generated React App without using API Gateway
- Webpack error: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema
- ValidationError: Invalid options object. CSS Loader has been initialised using an options object that does not match the API schema
- React Hook useEffect : fetch data using axios with async await .api calling continuous the same api
- How to generate a unique id automatically for the data that is posted to an API server using axios library in redux
- How to add page transitions to React without using the router?
- How to change the Swiper height or slide width in React JS without using fixed CSS
- React Native Vector Icons to fit the parent container without specifying a size prop (Expo)
- What is the best way to use a different API URL in production for a create-react-app using docker?
- Is there a way for me to send the 404 page using the Next.js api routes
- What's the best way to deal with an error in the server side and in the client side using nodejs + express
More Query from same tag
- React SPFx - Adding files to SharePoint list field using PnPjs
- How to use a local class in a Webworker with React?
- static HTML landing pages with Create React App
- Stripe Card Element default postcode
- Why Data disappear after refreshing React JS - Firebase?
- How to implement useMemo hook to sort the table by name?
- Exit animation for children items not working in Framer Motion
- How to implement percentage increase data from API in React?
- Is it possible for React data to persist upon reload if the value is boolean?
- When Ever i make user to signup through firebase he is authenticate but data is not written in firebase db?
- React Ant design 4 Input search display table data
- What is the Antd type for form onFinish?
- Redux - Store doesn't work
- React server side rendering and lazy loading of webpack
- Unhandled Runtime Error while executing a JS code
- How to keep the current state of a page after a refresh? - React
- How to use map()?
- How to toggle between values in a nested object
- Is there a way that we can trigger mouseover event on echarts library when hovering on any point of the series, rather than hover on a data point?
- How to render svg icons in react
- Can't scale SVG in React
- Trying to load content with useEffect and context
- Uncaught TypeError: Cannot read properties of undefined (reading 'params') - React
- React simple form file upload
- Why Mobx is useful?
- Unable to access localStorage in second tab when opened in incognito [Mozilla Firefox]
- TS2322: Type 'Count' is not assignable to type 'ReactNode'
- Get selected option attributes using React
- React SetState not working till second render if HTML element updated inside a function
- Does Enzyme test utility work with React.createClass?