All Questions
3,846 questions
3
votes
2
answers
69
views
Can I use a variable index in a useSelector call?
Suppose I have a long list of playerData in my redux store, and some players' data gets updated very often. Let's say I have a Player component and inside of it I want to access that player's specific ...
1
vote
1
answer
59
views
useEffect not triggering when redux state dependency is updated
I have a pretty simple Tile component that I want to change color when it's hovered (along with other associated components.) Right now it sets a Redux state when the component is hovered on. After ...
0
votes
0
answers
43
views
Why doesn't Redux Persist store data in localStorage [duplicate]
I am using Next.js and trying to use Redux Persist to save data so it remains even after a page refresh. However, when I refresh the page, the old data is gone. I'm not sure where I'm making a mistake ...
1
vote
1
answer
83
views
Error While using Redux - Uncaught TypeError: Cannot read properties of undefined (reading 'items')
I'm trying to access states from the redux store using useSelector(), but instead I get the following error-
AddToCart.jsx:7 Uncaught TypeError: Cannot read properties of undefined (reading 'items')
...
1
vote
1
answer
41
views
React mapStateToProps state calling reducers infinitely
const mapDispatchToProps = dispatch => ({
getUsers: (payload) => dispatch({ type: "USERS", payload: payload })
});
const mapStateToProps= state => ({
ctr: state.TestReducer,
...
1
vote
2
answers
230
views
Async/Await Not Working with Redux Dispatch Function in React
In this code snippet I want to know why async and await not working.
This code in my component I am sure that is no errors:
const { success, loading, error } = useSelector(
(state) => state....
1
vote
2
answers
81
views
My state is not changing while the api request is correct
I am using Redux and when I send a get request to authenticate user it is working, creating a token in cookies, but in Redux the state is not changing. What am I doing wrong? When reloading the page ...
1
vote
1
answer
53
views
Why component state is empty after dispatch redux action?
I am trying to implement the product list & search feature with debounce, but SearchProducts component's state search is empty after the dispatch action in the ProductList component. Can someone ...
0
votes
1
answer
57
views
Invalid Hook Call, How Can I Make It Work
I am trying to work with Redux. I have a select form for sorting data. I need to dispatch actions when onChange works but can't do it because I can't use it inside onChange event handler.
Form:
const ...
2
votes
2
answers
31
views
Usage of payload/action in React-redux reducers
I am currently trying to work through some example code and have the following in two separate slices:
Reducer in slice 1:
incrementQuantity: (state, action) => {
const { payload: index } = ...
1
vote
1
answer
33
views
Why props is an empty for me in StreamEdit component?
When I want to access props that are passed through Route in my App.js component, in StreamEdit component it's empty.
It must have match.params.id.
App.js
import { Route, Routes } from 'react-router-...
0
votes
0
answers
74
views
bump react-redux issue: Super expression must either be null or a function
I upgraded the Redux and react-redux versions in the project:
1.bump Redux from 4.2.1 to 5.0.1
2.bump react-redux from 5.1.2 to 9.1.2
I have a basic Connector, custom connect, code is as follows:
...
0
votes
1
answer
162
views
TypeError: Cannot read properties of undefined (reading 'numberOfCakes')
I am beginner to React and Redux
I am trying to learn Redux with React.
I have created a store in store.js as below -
const redux = require("redux");
const createStore = redux.createStore;
...
0
votes
1
answer
1k
views
Redux 5 - Selectors that return a new reference (such as an object or an array) should be memoized warning occurs with filter array method
I am a beginner Redux learner. I have a React 18 app. I am using redux 5 and react-redux 9.
When I run my application I get the below warning in my browser:
AnecdoteList.jsx:14 Selector unknown ...
1
vote
1
answer
45
views
'dispatch' is declared but its value is never read
'dispatch' is declared but its value is never read
this is the code where I'm using this:
actions/index.js
import { auth, provider } from "../firebase";
export function SignInAPI() {
...