Questions tagged [redux]

Redux is a predictable state container for JavaScript applications based on the Flux design pattern.

Filter by
Sorted by
Tagged with
0
votes
0answers
12 views

Replace a default Redux initialState file with an API call?

I am using a template React Project with Redux and there is a default menu file that is loaded with the initial state. I want to replace it with an API call and have that replace the exact file from ...
1
vote
1answer
25 views

Uncaught TypeError: Cannot read property 'main' of undefined when trying to use React MuiAlert

I am trying to build a Redux based notificator based on this example: https://material-ui.com/components/snackbars/#CustomizedSnackbars.tsx And here is what I came up with: import { Snackbar } from '...
0
votes
1answer
13 views

How to combine state sanitizer with existing middleware in React-Redux

My redux store is fairly large; Redux Devtools suggests sanitizing my larger objects to improve performance. I've followed the docs here: https://github.com/zalmoxisus/redux-devtools-extension/blob/...
0
votes
2answers
37 views

HOC React and Redux : Cannot access 'mapStateToProps' before initialization

I want make higher-order component / HOC wrapped with redux I tried something like that : export const Button = connect(mapStateToProps,mapDispatchToProps)( () => { return( ...
-3
votes
1answer
47 views

Expected 0 arguments, but got 1

I need some help with implementing redux in my react app. Typescript failed to compiled with the following error : TypeScript error in /Users/XXXXXXX/SignIn/index.tsx(12,71): Expected 0 arguments,...
1
vote
2answers
43 views

mapStateToProps not updating component with toggled state

new user to Redux so apologies for any silly mistakes. Ultimately, I am trying to toggle a className in component B as an onClick function toggles a state in component A. So it should be: Component ...
1
vote
2answers
22 views

react-router Link changes url but Route component doesn't render

I've been trying to implement react-router-dom, but it seems to conflicting (potentially) with either Redux, or Redux-persist. My index.js looks like import React from 'react'; import ReactDOM from '...
0
votes
0answers
14 views

Axios interceptor does not redirect browser in a React app

I have a Redux/React application with an OAuth2 proxy. When the proxy gives a 401 response, the user needs to be redirected to an authentication page. Here is the basic idea using axios and ...
0
votes
0answers
10 views

ImagePicker uploading Image to s3 and setting the state of imagaUrl

My team and I are working on a Profile Page that shows Profile Picture and Bio. We used expo-image-picker library for users to select the image they want and show the image on the app. I would also ...
1
vote
0answers
19 views

Redux State Updates but table does not update (even with pure & immutable state update)

i have been looking around for an answer to my problem and have found a lot about not changing the pre-existing redux state object in the reducer. My issue is that i seem to be changing my state okay (...
0
votes
2answers
35 views

Redux state to replace React Component internal state

I'd like to implement a redux store in multiple components of my web app. Basically, I want to migrate what currently is internal state to redux. I'm using a simple radio as an example. File without ...
0
votes
0answers
15 views

Call action without using Redux (Where inner App already uses Redux) in order to use IDLE?

I'm using React Idle and I want to log out the user with a logout function after X seconds. The logout function is located in an action file , works great (when user clicks logout). What I want is ...
0
votes
2answers
28 views

Angular NgRx dispatching action method

So we have this ordinary effect doSomething. What is the official way to dispatch another action, named doSomethingElse? The documentation doesn't really say anything about the right way. In the end ...
0
votes
0answers
13 views

Problem with React Native sliding up panel and keyboard avoiding view

I have a component inside my sliding up Panel which contains various text inputs and I haven't used any keyboard avoiding view but my content automatically slides up when I try to type something in ...
1
vote
1answer
22 views

How to transfer data from state to mapdispatchtoprops?

How to transfer data from state to mapdispatchtoprops? I get the url of the image and write it to state, then I want to pass this url to dispatch // State const [imgUrl, setUrl] = useState(null);...
1
vote
1answer
64 views

How to create an action with arguments that returns a promise?

Goal: create an action that returns a promise, that takes arguments, and utilizes dispatch. the best I've come up with for the action: export const loginAction = (arg1, arg2) => { return (...
0
votes
0answers
19 views

How to persist with data in a menu grid in React-Redux application?

I'm building an application in React-Redux, where you enter as an user, without any password or token just authenticating the user, and then you may view in home (/) the not answered or answered ...
0
votes
1answer
14 views

Why are some imported React-Native Redux actions changing values and triggering onEffects multiple times?

Here is my setup: // store/actions/user.js export const discoverFollowingStatus = followsId => { return (dispatch, getState) => { const userId = getState().user.user.id; ...
0
votes
1answer
19 views

Typing Redux toolkit's store in TypeScript

I'm trying to get started using Redux in React + TypeScript so I am following the Redux Toolkit's tutorials and try implementing it in a sample app. I am having a lot of difficulty with typings ...
0
votes
0answers
14 views

React Router Dropdown Calling another component passing parameters ids through url

I want to save a bill with relationships: provider and client. From BillForm I want to select client and provider from every dropdown, take selected provider id and client id from every dropdown, ...
3
votes
0answers
20 views

can not put file in redux array

I am uploading file in redux array and it seems it is getting file as payload since it logs in console but when i push it in array it puts empty object instead of actual file, i haven't faced this ...
1
vote
2answers
18 views

Redux Authorization Handle with custom Middleware

I need to make my redux API calls headers centralized. I mean i need a custom middleware that works before each api call and get token from 'Local Storage' and put it in current api call's header. I ...
0
votes
1answer
33 views

React Redux with Hooks - state is undefined

Actions export const budgetData = () => dispatch => { dispatch({ type: types.BUDGET_DATA, payload: fetch(URL_BUDGET) .then(res => { return ...
1
vote
1answer
20 views

Fetching from store vs. letting the parent fetch and deliver via props

Too many times when developing a component, I find myself wondering whether the component should fetch its data directly from the store, or have it passed via props - presumably to let the parent (or ...
5
votes
1answer
63 views

Multiple calls with dependencies redux-thunk

Question: I use redux-thunk and I want to receive posts. To receive posts I need to get users. So I have doubts about my thunk, Is it right to get all the data in one thunk, if not how to split it ...
1
vote
0answers
25 views

TypeError: Object(…) is not a function when invoking createStore

I was trying to use the createStore from redux to create a store for this app and it was okay until i started applying multiple store enhancers in it. So i get this error TypeError: Object(...) is not ...
0
votes
1answer
28 views

Unable to increase size(height, width) of react-phone-input-2

I am trying to use react-phone-input-2 in my form as it is providing many features like flag and formatting number etc.. But I am not able to customise the input using my own css. eg: height, width ...
0
votes
1answer
24 views

How to use react route params in connected redux selector?

I have a component connected to Redux: interface EditProgramCategoryProps { category: ProgramCategory; fetchAllCategories: () => void; } const PureEditProgramCategory: React.FC<...
0
votes
1answer
19 views

Where should I be updating filtered data, in saga, reselect or reducers?

I'm currently using reselect, redux-sagas and reducers. I have a filterParameter in state which holds filteredParameter values filterReducer.js: initialState = { filteredParameters: { ... } // null ...
0
votes
0answers
26 views

Wake up sleeping react components in react redux

I have an app with several tabs, when I click a tab for the 1st time everything renders well from the redux store. But when I switch tabs and come back to the 1st tab the components stop updating. The ...
0
votes
0answers
35 views

React custom hook using only useEffect

I created a custom hook that uses useEffect to update a redux store when certain values in the store change: import { useRef, useEffect } from 'react' import { useSelector, useDispatch } from 'react-...
0
votes
0answers
11 views

login using custom action react-redux-firebase

I am using react-redux-firebase to handle my firebase authentication and am attempting to create a user using a custom redux action (using the redux-thunk integration with react-redux-firebase). My ...
0
votes
1answer
49 views

is it possible, to get a props and pass it as a parameter to a function?

I'm trying to get a props from MapsStateToProps via react-redux's connect, then passing it to a child component. This prop is used as an argument to a function, the function is responsible returning ...
0
votes
3answers
20 views

Connecting multiple Components to the React Redux Store

I just recently started working with Redux and I managed to connect my <App /> component to the store with this code: const mapStateToProps = state => ({ ...state, }); const ...
0
votes
0answers
18 views

Using Stripe's email system for customer receipts

Question: Is it possible to use the Charge object for an itemised receipt? I'm building an online BMX parts store and am stuck on post-purchase emails. I'm using a react/redux frontend & ...
0
votes
0answers
30 views

API request return html markup in the live app, while works fine in localhost, React - Redux

I've been working on a web app using react with redux. I have successfully integrated redux with app which runs perfect fine in the localhost. The problem is when I deploy the app, it gives me an ...
0
votes
0answers
18 views

Best approach to access state in sagas?

I'm currently using reselect, redux and sagas. This is my situation. I have 3-4 api calls to fetch data in my app. Each of those api data, needs specific values from 1 of the main api fetches, which ...
0
votes
3answers
31 views

React renders my Component before it actually has Data

So I'm hard stuck on this Problem... normally I would just do a "ComponentDidMount" but since I'm trying to avoid using classes and only use react hooks I got stuck with the Problem. My Component ...
0
votes
1answer
29 views

type-safe useDispatch with redux-thunk

I'm using redux-thunk to use async action creators. The result is also returned to the respective caller. function fetchUserName(userId: number): Promise<string> { return Promise.resolve(`...
0
votes
1answer
31 views

Cascading calls for state update

Few questions regarding this approach: https://medium.com/@thomasburlesonIA/push-based-architectures-with-rxjs-81b327d7c32d Is there any general, well known name for such architecture, which I can ...
0
votes
0answers
32 views

JSON Parse error: Unexpected identifier “Not” while fetching when I add JWT auth header

I am currently working on a react-native money transfer full-stack app using react-native and redux for client-side and node for the server. I am having a problem with authenticating all requests with ...
0
votes
2answers
29 views

How to sum the value only once in react redux

I would like to know in my scenario: After receiving props, the function gets called in the compoentdidupdate method, in which am summing up the amount if id is same, But it keeps on adding the values ...
1
vote
1answer
24 views

State Management using a global js file without using any library in React

What is the basic Issue if I do state management using a JS file with all the state data and write functions to manipulate data in it. And export all these functions and state to different components ...
-2
votes
2answers
37 views

How do i access redux state from another react component?

I am developing a lottery statistics app that gets data from a csv loaded from an input then I was wanting to read this data to the redux store so I can use it across multiple components. I have ...
0
votes
0answers
34 views

Why does “object not function” appear?

I'm trying to connect firebase, but I get such an error: TypeError: Object(...) is not a function My store.js import { compose, createStore, applyMiddleware } from 'redux'; import thunk from 'redux-...
0
votes
1answer
14 views

How to add initialstate from expressjs to redux (nextjs)

I have initialstate coming from node and trying to add it with withRedux but my reducer overwrites initial state. Here is my _app.js: import React from "react"; import { Provider } from "react-redux"...
0
votes
0answers
64 views

Maximum update depth exceed error. What could be wrong here?

I need help here. I've already found a similar question here in StackOverflow (Similar Question) I've read and try to figure out what could be wrong with my code. I'm a little bit new as a developer ...
2
votes
1answer
30 views

Unable to edit input (material-ui & react-draggable)

I am unable enter input inside TextField that is looped over an array present in the react state. Please follow the codesanbox url to see the code. You can proceed the first page without entering any ...
-1
votes
1answer
55 views

change specific value of an obj with dispatch

i want to sett the errors that im getting from express validator i did include the image of that array in the question for example if there is an error on the email i want to set it on the ...
0
votes
0answers
13 views

using redux middleware to return a promise from the dispatch

I like the idea of using dispatch to return a promise dispatch({type: 'SOME SAGA TYPE'}).then(()=>{ // other logics }) I created this middleware to return a promise on the dispatches, however, I ...