Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [redux-toolkit]

Redux Toolkit (RTK) is the standard approach for writing Redux logic. It provides utilities to simplify several common Redux use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state at once.

0 votes
0 answers
24 views

TypeError: Cannot read properties of undefined (reading 'quantity')

Ecommerce site using MERN. This is the Navbar.jsx component. Error shows cant read undefined 'quantity' on line 72. ERROR MESSAGE Uncaught TypeError: Cannot read properties of undefined (reading '...
Mamik Saha's user avatar
1 vote
0 answers
19 views

inferred type of '...' cannot be named without a reference to '../../../node_modules/@reduxjs/toolkit/dist/createAsyncThunk' + TypeScript error

I have a react 18 application with typescript. I am using redux toolkit version 2.2.6. I am getting a TypeScript error that I do not know how to fix. The error is: The inferred type of 'fetchUsers' ...
qqq's user avatar
  • 868
-1 votes
0 answers
9 views

How debug updateQueryData from RTK query? [closed]

I need to sort out the data in the state for the first time after lifting the ban on anything, besides, I didn't succeed. I want to see what is in the "changeable drafts" and "diary ...
Fedor's user avatar
  • 1
1 vote
0 answers
7 views

How to handle error as success in RTK Query?

I have an endpoint that throws 404 when nothing is found. However, in my app I want to treat those 404 of that endpoint as a 200. transformErrorResponse: (error, meta) => { console....
Walter Monecke's user avatar
0 votes
0 answers
8 views

How to write custom onQueryStarted() Redux RTK API Slice function

I am having trouble implementing a custom onQueryStarted() function in Redux RTK API slice. The problem is TypeScript. Assuming I have this createFoo: builder.mutation<GeneralResponseType, ...
four-eyes's user avatar
  • 12k
0 votes
0 answers
9 views

How to define type for error in Redux RTK Api Slice

I want to set the type for an error in the Redux RTK API Slice This is my function createFoo: builder.mutation<GeneralResponseType, CreateFooRequest>({ query: payload => ({ ...
four-eyes's user avatar
  • 12k
1 vote
1 answer
30 views

How do I get my button to conditionally render Add to cart state and the quantity state?

I have been attempting creating a shopping cart with product list from https://www.frontendmentor.io/challenges/product-list-with-cart-5MmqLVAp_d I am currently trying to use redux as I would like to ...
ChrisKola99's user avatar
-1 votes
0 answers
62 views

unexpected behaviour of dispatching action in redux

I have the following async thunk function: const loadProject = createAsyncThunk( '[Project API] Load Project', async (project: IKProject, { dispatch }) => { await kProjectService....
Y_Moshe's user avatar
  • 432
0 votes
1 answer
22 views

RTK query mutation catch block

I am using RTK query for comunication with API. When mutation fails, I need dispatch some alert, like follows: const [addPost, { isError, error, }] = useAddPostMutation() ... useEffect(() =>...
Mormen's user avatar
  • 180
0 votes
0 answers
19 views

Order of action processing in Redux Listener Middleware

I'm trying to implement buffering using Redux Toolkit Listener Middleware. I would like to buffer web socket messages until some entity is loaded using RTK Query. I discovered that some messages are ...
baawhee's user avatar
  • 43
-1 votes
0 answers
33 views

redux-toolkit No reducer provided for key "" [closed]

I'm getting the following error: No reducer provided for key "merchant" Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are ...
TEJAS's user avatar
  • 1
0 votes
1 answer
20 views

Using Redux Persist [duplicate]

I was using Redux Toolkit and tried to use Redux Persist but on terminal it shows this. A non-serializable value was detected in an action, in the path: `register`. Value: [Function: register] Take a ...
kodeater's user avatar
0 votes
1 answer
31 views

update multiple objects in array using redux toolkit

I have a store called stories which has a userStories object stored. Example of userStories object inside store: userStories: { userId1: [{storyId: 1, viewedBy: [id5, id2, id9]}, {...
Max adam's user avatar
  • 105
-1 votes
1 answer
47 views

Redux Question: When <App/> Component re-renders, does it cause all selectors to run again

I have read in Redux docs: The selector will be run whenever the function component renders (unless its reference hasn't changed since a previous render of the component so that a cached result can ...
moath's user avatar
  • 9
0 votes
0 answers
13 views

How to use cached data in a different component using useLazyQuery in RTK Query?

I am using useLazyQuery and a trigger function to trigger an API call from a component(let's say A) but in another component(let's say B) I just want to subscribe to the cached data, I don't want to ...
Derek emmanuel's user avatar

15 30 50 per page
1
2 3 4 5
244