score:4
Accepted answer
i'm not familiar enough with api in rtk, but i played a bit with typescript there and found out that if you declare tagtypes
in your createapi object it solves problem:
export const remotescriptsapi = createapi({
basequery: fetchbasequery({
baseurl: '/api', prepareheaders: (headers) => {
headers.set('accept', 'plain/text, application/json');
return headers;
}
}),
tagtypes: ['scenes'], // <---- declare your tagtypes before you use them
endpoints: (builder) => ({
getscenes: builder.query<number[], void>({
query: () => ({ url: '/scenes' }),
providestags: ['scenes']
}), ...
Source: stackoverflow.com
Related Query
- Type error when adding providesTags in RTK Query
- Element type error in Query component only when using a HOC
- Type error when using onMutate in react query (Optimistic Updates)
- Undefined Error when Fetching API using RTK Query React/Redux
- Typescript Type error when Adding custom new property 'tab' inside 'Typography' in Material UI Theme
- Type Error when using Typescript with React-Redux
- "Rendered more hooks than during the previous render" error when the initial value for the hook is a query result from a database
- Objects are not valid as a React child getting error when adding div?
- Typescript error "Property does not exist on type 'JSX.IntrinsicElements'" when using native web component
- React JS error when I am installing any type of package
- Flow type error when using React.Node
- Gatsby keeps complaining Cannot query field "fields" on type "MarkdownRemark" when I have allMarkdownRemark
- Getting error when using type "React.ReactNode" to children. Which type should I use?
- Typescript returns error when a function type is FunctionalComponent, but not for arrow function
- Property 'dispatch' is missing in type error when passing root store to root component
- React Type Error when implementing authentication with Python
- React Apollo Client Query throwing error "Invalid prop `children` of type `array` supplied to `Query`, expected `function`"
- How to solve parsing error when export type in CRA typescript environment
- How to get rid of Typescript type error when overriding MuiContainer classes?
- Relay Error when deleting: RelayMutationQuery: Invalid field name on fat query
- React syntax error when adding class properties
- unknown type error in graphql query while fetching content?
- How to stop Redux RTK query from retrying on error
- Type error when using render when defining table columns in material table React
- AppSync/Amplify Query using a Parameter Error ""Validation error of type FieldUndefined:"
- Typescript throwing an error for the wrong type even when the type is right
- Type error when using function with the return type NextPage
- RTK Query in Redux-Toolkit is returning data of undefined, when I console.log the data it appears in console
- "No exported member" error when trying to add & { session: Express.Session } to type MyContext when following React, Express and Typescript tutorial
- Type '(isOpen: boolean) => void' is not assignable to type 'boolean'. Error when using Modal in reactjs
More Query from same tag
- react-final-form state does not contains empty inputs
- Why is the table data not being rendered?
- TypeError: environment.dispose is not a function when running npm test
- Is there a away to pass lifecycle hook as a param to a HOC in React?
- REACTJS - Import CKEditor 5 from online build
- Difference between decorators and mixins in react
- Object cannot render as React Child (Error while using array.filer() method)
- How to do a custom logic and redirect to another pages in react or nextjs with useEffect hook
- getting latitude and longitude from react-leaflet when moving the mouse
- react-redux Component failing to load at the first API call
- I am doing a chrome extension with react but it refuses to execute inline script
- Fetching data in React's useEffect() returns data “undefined”
- How to prevent my refinementList component from rerendering and losing state?
- Cannot read property 'handleReset' of undefined
- React Native Redux: Error Can't find variable mapStateToProps
- Javascript dynamically inserted later on: how to make it run?
- Passing Ref through React Router To the Components?
- Warning when using a component from a variable
- Strategies to implementing a conditional Navbar if a user is logged in or not
- react native custom drawer navigator
- React: Passing local state to parent component
- SCRIPT1053: Const must be initialized in IE 11, d3.js
- How to change data of children with useState?
- Returning a filtered nested array inside an array of objects in React
- Error using react-map-gl in create-react-app
- Distributing ReactJS components written in ES6 and usnig them inside ES5 source code
- How to use the Trans component for bold or italicized text in the middle of a translation
- onmouseover not working with React.js
- how to reset the value of fields without using refs in reactjs?
- Import object in React not defined