Questions tagged [react-redux]

The react-redux package provides the official React bindings for Redux: the `useSelector` and `useDispatch` hooks and the `connect` higher-order component. Use this tag for questions about accessing and updating Redux state in React components.

Filter by
Sorted by
Tagged with
1 vote
2 answers
33 views

Undefined data while using redux useSelector hook

I created a product reducer, product action, and home file along with constants file (mainly to name and store the type of the action). In Home I was trying to get the products from the backend that ...
Aditya Sharma's user avatar
0 votes
0 answers
14 views

How to manage pre-existing and changing redux state in react functional components, or stop previous data loading again [duplicate]

I have a pretty complex form backed by a large state object, which can start off blank, but can also be loaded from a data store. The problem is that although the correct id is brought in from ...
Michael Coxon's user avatar
-1 votes
0 answers
12 views

REDUX data don't appear in store

try to create it since 2 days, don't understand what's happening. Somebody could help me pleeeease ? :) get data from an api, log ok, get_blog_posts res.data ok in log, but the dispatch in store seems ...
solene's user avatar
  • 19
0 votes
1 answer
21 views

Redux ToolKIt Query getState on prepareHeaders show null on getState().auth.accessToken

Hello everyone so I have problem with my RTK Query where the prepareHeaders getState() not getting the value from the auth state. So I have accessToken state in my store where to store the value of ...
Josh Lee's user avatar
0 votes
0 answers
14 views

Get data with React Redux Call Axios many time but can not render data till I refresh it

I am create website with React Redux using axios to get data API, but when I want to render it to my page, it can not read till I refresh the page by hot reload or saving project again. Here is my ...
ThienBao's user avatar
-1 votes
0 answers
15 views

How to print component with large data set probably 20k array with react-to-print or any other alternative?

I'm using react-to-print library to print table compoenent, works fine with maybe 50-100 dataset but doesn't work with few thousands data. I assume with large dataset react cannot render all the ...
Dinesh Thapa's user avatar
0 votes
0 answers
15 views

How to dynamically calling a method in ReactRTK slice using string variables

I am looking to dynamically call a method in a slice from a component, which I'm not sure how to do or if it is possible. I have the following slice: const initialState: ProductsState = { ...
Hayden's user avatar
  • 1
0 votes
0 answers
19 views

Selecting User Object from the api Reducer

I am recently Learning redux tool kit & I faced the following problem: I am trying to select user object from login endpoint which is defined on apiSlice created using createApi, I am injecting ...
Black Sword's user avatar
0 votes
1 answer
19 views

is there an analogue of 'counstuctor' mobx in redux-toolkit?

We have a store with an application theme We want to rewrite it in redux-toolkit Is there something similar to "constructor" in redux-toolkit so that multiple functions can be called ...
шш гк's user avatar
-1 votes
0 answers
14 views

how to calculate all addToCart product total price in react and redux [closed]

Hi Everyone i am having an issue with react&redux. Basically i would like to know how to calculate total price in cart when you have both "Normal Price Product" and "Discounted ...
The Jazz song's user avatar
-1 votes
0 answers
15 views

Making different fetchbasequery based on endpoint in RTK query [closed]

import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react"; const baseQuery = fetchBaseQuery({ baseUrl: process.env.NEXT_PUBLIC_BASE_URL, prepareHeaders: (headers, { ...
shawnMarkus's user avatar
0 votes
0 answers
16 views

I am getting babel error while using Yarn workspaces for monorepo

I am new to software field in general and currently I am trying to use monorepo (using yarn workspaces). I have two react applications (bootstrapped with simple webpack and NOT create-react-app) ...
Pikalo's user avatar
  • 1
0 votes
1 answer
23 views

can we call action function of a reducer from another reducer? [duplicate]

i am trying to call a reducer function from another reducer function. but i get error 'redux.js:283 Uncaught Error: Reducers may not dispatch actions.' this is my counter reducer: const counterReducer ...
Muhammad Afshal's user avatar
0 votes
0 answers
12 views

Integrate the 0Auth/google to the react-redux project

I'm developing a social media app using React and have integrated Redux for state management. Now, I want to add Google OAuth login functionality using the @react-oauth/google package. The problem is ...
AliReza's user avatar
-2 votes
1 answer
14 views

how to debug TypeError: react_redux__WEBPACK_IMPORTED_MODULE_2__.useSelector(...) is undefined [closed]

Edit to add: yes, it's about debugging. And I could rewrite the question in a way that it suits the stackoverflow guidelines (heres my code, another one like so many ...) Point though is, there are at ...
til's user avatar
  • 858
-2 votes
0 answers
21 views

Utilizing useEffect to set form value to store

I'd really appreciate a sanity check on my approach here. I'm using RHF, Yup, & Redux. I want data a user enters on my form to persist if they navigate away from the form and return, so I decided ...
Jord's user avatar
  • 36
-1 votes
0 answers
17 views

I want to access the updated states from the redux toolkit after a dispatch New action

I want to access the updated states from the redux toolkit after a dispatch new action "use client"; import Product from "@/components/Product"; import { ProductType } from "@...
kami-The-Coder's user avatar
1 vote
0 answers
24 views

useSelector conflict between application and npm package

Issue Description: I have a React component within my application where I use useSelector to fetch data from the application's Redux store. In the same application, I also incorporate an npm package. ...
Gopi's user avatar
  • 41
0 votes
1 answer
24 views

TypeError: state is not iterable on React

I created a mern app that allows you to add workouts and meals to the app, it is allowing me to create and upload the workouts but the meals throws: state.meals is not iterable TypeError: state.meals ...
marvin's user avatar
  • 1
1 vote
0 answers
38 views

Redux states updates from another package

I have 1 react project A which I used Redux. Which I am using B (Which is another package developed by my team) That package also has Redux in it. Whenever I am using that package in my current ...
Dishit's user avatar
  • 11
0 votes
0 answers
13 views

React-Saga giving Type-Error - isBatchingLegacy

I am working on a module federation architecture which consists of State management app written in react 17 which uses redux-saga for async calls to firebase an app-shell which has imported the state ...
Ashish Mathew's user avatar
0 votes
1 answer
35 views

Jest Snapshot tests failed after updating react native versions from 0.70.13 to 0.72.4

After Updating my react native version, I am keeping getting errors when I run the jest tests, it is regarding the snapshot tests for react redux connected components React: 18.2.0 React Native: 0.72....
Zijian's user avatar
  • 207
1 vote
2 answers
25 views

How to handle multiple input field which is rendered using map method, with react-redux?

I have a product list(without quantity) in json-server and fetch using react-redux and rendered in table. I also have a input field to get quantity from user to calculate the total by mutiplying ...
Trunks's user avatar
  • 29
2 votes
1 answer
42 views

Cannot add property 0, the object is not extensible in react.js

When I try to select a checkbox, it shows the error 'Cannot add property 0, the object is not extensible,' and I'm unable to add items properly. Can someone please help me with this? const [formData,...
Shiva Giri's user avatar
0 votes
0 answers
19 views

React redux not updating on PrivateRoutes.js [duplicate]

Trying to implement PrivateRoutes.js using react-redux to update the isAuthenticated store. I think the problem is with when the render occurs but can't seem to get it to work. PrivateRoutes.js import ...
shan0b1's user avatar
  • 11
1 vote
1 answer
43 views

Why getPosts() is called within dispatch parentheses? How dispatch is working here?

export const getPosts = () => dispatch => { dispatch(setPostLoading()); axios .get('/api/posts') .then(res => { dispatch({ type: GET_POSTS, payload: res.data ...
Ashik Ghosh's user avatar
1 vote
1 answer
22 views

Redux Reducers error when I use combineReducer method

I am trying to integrate Redux-Persist to my react app. I am using Redux currently for state management and had no issues when I used configureStore and added my reducers to it. But, when I use the ...
mostafa ibrahim's user avatar
0 votes
0 answers
30 views

Redux implementation in search prompt

I have a problem with my application. On my page there are several components, Header.jsx, Hero.jsx, Footer etc. In Header I have implemented the search bar and it displays dynamic response, when I ...
Adnan Sk's user avatar
0 votes
1 answer
35 views

React hook form not populating with fetched data

I have a form, which is part of a tabbed set of panels. The form itself looks like this: import * as React from "react"; import { useForm, SubmitHandler, Controller } from "react-hook-...
Michael Coxon's user avatar
0 votes
1 answer
20 views

Navigation from login to another page is not happening in Redux

Here I have created a login form, and in the reducer I already store the registered user's email and password. If any one gives proper login credentials, they will go to the logout component; ...
Sougata Mukherjee's user avatar
-1 votes
0 answers
15 views

React Redux: Selected category not filtering announcements

I'm building a React app with Redux for state management. In one of my components, I'm trying to filter a list of announcements based on a selected category from Redux. However, I'm encountering an ...
Aben's user avatar
  • 1
-1 votes
0 answers
17 views

"Could not find router reducer in state tree, it must be mounted under 'router' " connected-react-router

I am fairly new to React and Redux and I am working to update an outdated React application. I am attempting to upgrade the connected-react-router dependency from 6.3.1 to 6.5.2, however, when I do so ...
Schnibbles's user avatar
0 votes
0 answers
27 views

Should I be using redux to allow communication between TabBar and Screen?

In my application, I am using a custom tab bar. It allows you to open up a menu where different filters and settings can be set which affect two of the three tab screens I have. Most of my data is ...
TemporaryName's user avatar
-2 votes
1 answer
31 views

React-Native Redux-Toolkit Redux-Persist: Cannot read property 'dispatch' of undefined

Here's the error that is shown in Emulator This error has appeared while I was integrating redux-persist with Redux Toolkit in the React-native application. I have tried to find various solutions but ...
Sufiyan Khan's user avatar
-1 votes
0 answers
16 views

How to use reduxjs/toolkit to pass refs through my react program

I've been trying to resolve it for at least 4 hours. Now it's giving this error, but a few hours ago it didn't even create the states within redux. Can someone help me? I'm making a navbar, and to ...
Migliorelli's user avatar
-2 votes
1 answer
32 views

why createStore is strikethrough? [duplicate]

Im trying to do a project with react and redux but the state doesn't work. I think it is beacause when I initialize the store, the method createStore appears crossed out, as seen in the image. How can ...
StayCoold's user avatar
-1 votes
0 answers
20 views

Passing props between not "relatives" components using redux

i'm approaching mapStateToProps and mapDispatchToProps, i made a component called Prova.js that contains the props i want to be shared between my components, here it's: import React, { Component } ...
Pepitos333's user avatar
0 votes
0 answers
21 views

Getting Error 'Error getting locale from store!'

In my react application, I am using class components with redux react-redux-18n libraries and some of the times we are getting below errors in my browser console Please help me with solution. Here is ...
mohan bhonu's user avatar
-1 votes
0 answers
17 views

RTK Query - how many tags is too much?

My app is a heavy user of RTK Query, and we have a lot of generated dynamic content that needs smart-refreshing, which is why we are really leaning towards using RTK Query. Looking at our current data,...
ejlu's user avatar
  • 39
-1 votes
1 answer
44 views

How to update existing object or add new object of an array of objects conditionally using es6 in js

I want to update my state with the given object (action.payload) if the id of both objects are matched. Otherwise I want to push the certain object into the following state. This is a Redux project so ...
Joyram Das's user avatar
0 votes
1 answer
134 views

Redux trigger Multiple times

When i recive message from the Socket The function trigger once but inside the reducer it hit multiple times 3-5 each time a thing useEffect(()=>{ socket.on('message', (data) => { ...
Ahmed Saman's user avatar
-1 votes
0 answers
10 views

Error while using redux/toolkit with react-native-paper in expo react-native project

I am getting an error while using the Redux/toolkit with the react-native-paper. I have followed the exact instructions as in the official react-native-paper docs, on how to integrate it with redux, ...
MUNEEB UL REHMAN's user avatar
-1 votes
2 answers
71 views

Await / axios always return pending action with redux toolkit

I'm moving from Duck to redux toolkit. Now I'll try to explain this behavior, this thing: = await axios always return the pending action. Removing the await the api call "works", but return ...
Asinox's user avatar
  • 6,753
-1 votes
0 answers
24 views

check for new response from server

I have redux-saga which call into API for the response, but response can be change in a minute or two. what is the best way to double check or detect for a new response of same API call? Should I go ...
Arthur788's user avatar
0 votes
0 answers
27 views

Wait for dispatch action to be completed before redirecting back to previous page in a modal

I have the following modal that I am using in my react application to delete a project. I am passing a function as a props to the modal that dispatches the delete action. <DeletionModal ...
Unah Henry's user avatar
0 votes
0 answers
21 views

How can 405: Not allowed on DELETE be resolved with a C# endpoint when URL and CORS are configured?

React-Redux API call: The API variable is correct as it works on POST on this same endpoint. I added the rowId to the end of the URL because I read that it was needed for Delete. export const ...
Geoff's user avatar
  • 353
0 votes
0 answers
8 views

Accessing Global Window Object from MVC Razor and React Web Component

We have a website which is a mix of .NET Razor pages and React Web Components. There are a lot of user-input fields which require validation (e.g., only ASCII characters are allowed) and to handle ...
Dominick's user avatar
  • 322
0 votes
0 answers
7 views

Can't not config store using redux in Reactjs

i got that problem in my project "store.getState is not a function TypeError: store.getState is not a function" This is in configStore.js import { combineReducers,createStore, ...
Nguyễn Hoàng's user avatar
1 vote
1 answer
35 views

Why is Redux dispatch taking this much time?

I open a file which is parsed and then dispatched into redux state. Timing the dispatch gives me much longer times than expexted. It seems like the dispatch itself takes several hundred milliseconds ...
1jss's user avatar
  • 33
2 votes
1 answer
31 views

How to get previous data with RTK Query?

I use a hook in a standard way: const { data, isLoading } = useGetSomeDataQuery() Data is an array of items with id. I use polling so data updates periodically. Items can be removed from the array on ...
Sergei Basharov's user avatar

1
2 3 4 5
468