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.
redux-toolkit
3,654
questions
0
votes
1
answer
13
views
Using Redux Persist
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 ...
1
vote
1
answer
29
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]}, {...
0
votes
0
answers
20
views
Redux State Does Not Change When Modified From useInterval
so im trying to load user data from localStorage and set it to the redux user state. heres what i have done:
Where The User Is Being Used:
import Fruit from "../components/Fruit"
import { ...
0
votes
1
answer
35
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 ...
0
votes
0
answers
9
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 ...
0
votes
1
answer
24
views
how can I immediately updating data with redux when I fetch API ؟ [closed]
when I update data using API the state in redux not updating immediately but should I reload the page to view the values updating ???
I get already the data but if I want the new values of data must ...
-1
votes
0
answers
27
views
Why do all posts have one identical copy with identical data [closed]
I've recently been making blog pet project and encountered problem of posts having identical copies. Because of that when I try to add reactions to the post I keep getting next error It starts from 1 ...
0
votes
1
answer
20
views
RTK Query: Middleware - Property 'error' does not exist on type '{}'
I am trying to create a errorMiddleware that will toast message whenever there is an error occuring from the api calls.
The action arguement is throwing a TS type error that says:
Property 'error' ...
0
votes
0
answers
19
views
Syntactic problems with Redux middleware when try to add .concat(authMiddleware)
Here is authMiddleware:
"use client";
import { Middleware } from "@reduxjs/toolkit";
import { clearUserProfile } from "../reducers/userProfile";
import { clearIdToken } ...
-1
votes
0
answers
17
views
Cannot setup Redux debugging with `remote-redux-devtools`
So I've been trying to incorporate remote-redux-devtools in my middleware for debugging of Redux in React Native.
Previously I used Flipper but since it's being deprecated I need to find another ...
-1
votes
1
answer
42
views
Resolving the issue : Cast to ObjectId failed for value "[object Object]" (type string) at path "_id" for model "products"
Error message:
Cast to ObjectId failed for value "[object Object]" (type string) at path "_id" for model "products".
I'm attempting to retrieve a product, but I keep ...
-1
votes
1
answer
24
views
How to clear the cache of a query in RTKQuery
I'm currently in a situation where I'm questioning the best way to handle this situation with RTKQuery:
I have a table that displays a set of data. In this table, you have the possibility to select a ...
1
vote
1
answer
26
views
Redux-toolkit: Error: An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft. + void
I have 2 apps, notes app and anecdotes app. Both are React 18 apps. And I am using the Redux-toolkit.
Both apps are fairly similar. One difference is that the notes app has a reducer to toggle the ...
1
vote
0
answers
29
views
how to use localStorage in redux-toolkit with nextJS?
So i have a problem with localStorage and nextJS, and I need SSR to work. Here is the code:
import { createSlice } from "@reduxjs/toolkit"
const initialState = {
theme:
typeof ...
-3
votes
1
answer
58
views
TypeError: 0, _$$_REQUIRE(_dependencyMap[15], "redux").isAction is not a function (it is undefined)
Everything works when you remove the persisted reducer, and does not work with the persisted reducer. This is likely due to an issue with redux-persist, which is an older but still extremely popular ...