Skip to main content

All Questions

Tagged with
1 vote
1 answer
84 views

Redux-Toolkit (RTK) Query get mutation endpoint loading state

I have a component (like a dialog box) that provides the Submit button. This dialog component then renders a form component. Form component includes all the fields and also RTK Query to send the ...
Robert Koritnik's user avatar
2 votes
1 answer
74 views

Redux-Toolkit-Query: polling, selectfromReult with selectors

I am using below Redux-Toolkit Query (RTKQ) hooks to get information from one of the API and polling this for every 5 seconds, and selectFromResult to get the desired data. const selectorData = ...
CodingEzio's user avatar
2 votes
1 answer
44 views

Conditional api endpoints for different tables react-redux

I have am edit component that should be used for three of the tables in my database. However I'm running into React Hook is called conditionally. I want the conditional hooks because the table that is ...
honks69's user avatar
  • 23
0 votes
1 answer
36 views

Looses focus after write one word in input when use UseSelctor. why?

Here is parent and child. i use UseSelector to get state and pass it child component. But when i write something in input it looses the focus. why? enter image description here enter image description ...
Ashish Pundir's user avatar
2 votes
1 answer
58 views

React useState not rendering the current onClick

I have a quandary on the code I'm trying to execute. I'm using controlled inputs and I'm passing the response from an API to a child component, but it is rendering the last value. Here is my code. ...
cruz's user avatar
  • 91
1 vote
1 answer
785 views

Setting the results of RTK query with local state in useEffect gives Maximum update depth exceeded warning

I am trying to set the results of RTK query to the local state so that I can change the list based on user actions. See my full code below: but the relevant code is these two statements: const { data: ...
pkpk's user avatar
  • 842
0 votes
1 answer
73 views

using 2 interdependent hooks

I need to use 2 hooks that depend on each other: useHook1() returns a list of ids and useHook2(id) is called on each of the ids and returns a name. Basically what I want to do is: const [allData, ...
guckmalmensch's user avatar
1 vote
1 answer
2k views

Unit testing for mutation RTK Query with fixedCacheKey

I'm currently running RTK Queries for my project and i'm stuck on how to test ComponentTwo. The below is from the RTK Query doco and is it the exact same scenario I'm in. For me, in ComponentOne I ...
John Z's user avatar
  • 161
-1 votes
1 answer
401 views

Getting type mismatch when passing a parameter to Redux Toolkit Query function

I am trying to pass a string to a query in Redux Toolkit (TypeScript) foo: builder.query<FooResponse, void>({ query: (bar) => ({ // bar gets automatically the type QueryArg ...
four-eyes's user avatar
  • 12.6k
0 votes
1 answer
1k views

When do I use `useDispatch` & `useSelector` hooks with `RTK Query`?

I've started using Redux Toolkit with RTK Query for developing a client-side application that relies on API requests for data. However, I've come across a dilemma. Following the Redux Toolkit ...
SYKO's user avatar
  • 71
1 vote
1 answer
62 views

React redux toolkit useGetFilterProductsQuery and useGetFilterProductsByCategoriesQuery are not defined as functions

I am making a react app using redux toolkit for state management, Here I am getting error message app_api_apiSlice__WEBPACK_IMPORTED_MODULE_1_.useGetFilterProductsByCategoriesQuery is not a function ...
COdeingNinja's user avatar
0 votes
4 answers
3k views

React useEffect: how prevent a RTK query mutation to be executed twice?

I have this Component: /* eslint-disable */ import React, { useEffect, useState } from "react"; import { usePostValidateMutation } from "./features/apiSlice"; export const App = ()...
sineverba's user avatar
  • 5,172
1 vote
1 answer
31 views

Having trouble understanding rtk queries

I'm having trouble understanding how to properly use rtk queries in my code. Initially, they're loading as undefined, which is why I'm adding if statements looking for truthiness, but then this leads ...
Mathew's user avatar
  • 972
0 votes
1 answer
333 views

Passing a state argument set by useEffect to RTK Query's queryFn

I'm passing in a boolean argument, usingAsSignUp, into the queryFn. Unfortunately, usingAsSignUp always results in undefined! How do I get it's values? usingAsSignUp is state set by useEffect in the ...
saner's user avatar
  • 438
0 votes
1 answer
452 views

Use RTK Query inside a hook

I want ta call a RTK Query inside a function to implement some infinite scroll (by fetching new group of data each time it is needed by calling loadMore), so I've tried to use state (myDataState) but ...
Camille Gallet's user avatar

15 30 50 per page