All Questions
8 questions
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 ...
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 ...
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.
...
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 ...
2
votes
1
answer
2k
views
how to conditionally call a RTK-query hook in a loop though we cant use it inside useEffect
useEffect(() => {
const fetchServiceProducts = async () => {
if (isSuccess === true && data) {
for (let i = 0; i < data?.data.length; i++) {
const serviceid = data....
1
vote
1
answer
2k
views
RTK Query custom hook Typescript occurs Invalid hook call. Hooks can only be called inside of the body of a function component
Just learning some nexts.js with rtkquery with typescript and occur this error in useEffect in
GoogleMapComponent.tsx, code below. React site said that i broke some rules of hooks using, but this is ...
1
vote
0
answers
312
views
RTK Query Fetching data from restricted routes
In my app I have a protected Route 'userRoute' and verifyJWT middleware. On the front end I have a page where I make a request to an endpoint "getUsers" that is in the protected 'userRoute',
...
4
votes
2
answers
4k
views
RTKQ - Select data without hooks
I'm trying to select cached data from RTKQ without using the auto-generated query hook, but I'm having trouble understanding the docs
const result = api.endpoints.getPosts.select()(state)
const { data,...