Category "redux-toolkit"

(react redux toolkit) i want to know using action with multiple prameters

i recently started @reduxjs / toolkit. when i see code or documents of this, it not is not worked (undefined...) or too complicated(prepare?? createaciton??). i

Should I use Redux or Redux-Toolkit? [closed]

I am new in studying Redux. Then I know the existence about Redux-toolkit. My question is which should I use? Can Redux-toolkit replace Redux

Redux -Having a 404 errror and state.category.push(action.payload) not a function error

I'm getting a 400 client error and saying state.category.push is not a function and the current state is pending. I will be happy if someone helps me out on thi

How to run async call on a reducer?

import { createSlice, PayloadAction } from "@reduxjs/toolkit" import { Dispatch } from 'redux'; import axios from "axios" const API_URL = process.env.REACT_APP_

Optimistic updates for item create in RTK Query

Can't figure out how to get optimistic updates to work properly when I'm creating a new item rather than updating the existing one. The optimistic updates do wo

reduxtoolkit mocking store with typescript

I found this code from redux documentation // test-utils.jsx import React from 'react' import { render as rtlRender } from '@testing-library/react' import { con

Redux toolkit: Uncaught TypeError: Cannot read properties of undefined (reading 'type')

I get the following error when I add a specific action in the extraReducers inside a slice: Uncaught TypeError: Cannot read properties of undefined (reading 'ty

How to fix circular dependencies of slices with the RootState?

I recently started using redux-toolkit and started writing my reducers using the createSlice following their docs. One reducer, let's call it reducerA, imports

Redux RTK not auto-generating react hooks

Could not find any info on this that explains why its not generating and how to force it to re-generate these hooks. First I thought I had to run the app to get

Upload Image with Axios Post request

I am trying to make a post request to an api to upload a user image and send it to the api for profile settings.But i always receive "the image field is require

Entity adapter getSelectors method generates "Cannot read property 'map' of undefined" error

I am trying to use createEntityAdapter from reduxjs/toolkit to generate selectors automatically. I have created a "select all" selector successfully using creat

How to use redux toolkit's preloadedState and createSlice together properly?

I am trying to migrate to redux toolkit, but just encountered an issue. Here's an example of simple counter slice. import { createSlice } from "@reduxjs/toolkit

How to type properties in merging object for getInitialState of createEntityAdapter object?

I want to type status with FetchingStatus type. How to implement that? type FetchingStatus = 'idle' | 'loading' | 'succeeded' | 'failed'; const initialState =

React I have an endless loop rendering my edit component

I have two components. My dashbord-component, in which I am dispatching the getAllDropDownRessort, which triggers the findAll function in my dropdownRessortSlic

Exported variable 'store' has or is using name '$CombinedState' from external module error Redux toolkit and redux persist

Hi I'm trying to get redux persist working with redux toolkit (also in typescript) I'm getting the following error: Exported variable 'store' has or is using na

Reset state to initial with redux-toolkit

I need to reset current state to initial state. But all my attempts were unsuccessful. How can I do it using redux-toolkit? const showOnReviewSlice = createSlic

Argument of type 'AsyncThunkAction<any, void, {}>' is not assignable to parameter of type 'AnyAction'

store.ts export const store = configureStore({ reducer: { auth: authReducer }, middleware: [], }); export type AppDispatch = typeof store.d

does redux change the reference of rootState object when a field's value in a sub state changes?

i have my redux states setup like this rootState subState1 field1 field2 subState2 field1 field2 multiple sub

RTK Query: Specifying error type per endpoint

Is there a way to specify error response per endpoint? Like we can specify Result & Request type when defining a query or mutation. I did went through the d

How to apply createEntityAdapter to createApi slice

I have implemented successfully a redux-toolkit api. Now Im trying to use createEntityAdapter to be able to use the pre-built selector methods. import { creat