Questions tagged [react-redux]

Official React bindings for Redux

Filter by
Sorted by
Tagged with
0
votes
1answer
17 views

react-native : How to store and get stored data simultaneously from redux

I am using redux to store data from an api and in the very next step i need to get the stored data. this.props.fetchdata(id) // initiates the action to call the api, stores the api response in store. ...
1
vote
1answer
18 views

How to prevent React component mounting if props are empty?

I have a component which works with third party library and I need to add listener after component mounts. For some reason I can't add listeners without data which asynchronously fetched from server ...
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
0answers
20 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 (...
1
vote
1answer
30 views

how to implement child routing in functional components

I am new to React. I am facing an issue for adding child routes with functional components. I got to know that for class components we use like <Router> <Route component={Main}> ...
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 ...
2
votes
1answer
31 views

Prevent component from showing once authenticated

I have a login flow. Everything is set up correctly and it redirects users to "/" once authenticated My current issue is that when they are authenticated and I type /login it will briefly show the ...
0
votes
0answers
19 views

React phone input 2 with react hook form

I am using PhoneInput along with react hook form, I want to enable save button only if phone number is valid Code: <form onSubmit={handleSubmit(onSubmitRequest)}> .......................
-1
votes
1answer
64 views

Why do I need to add curly braces to the action creator?

Action creators: export const addTodoCustom = function (text) { return { type: "ADD_TODO", id: nextTodoId++, text }; }; Right statement: import * as actions from "....
0
votes
1answer
23 views

How to navigate from one stack or module to another stack or module

Appnavigation.js import { createAppContainer, createSwitchNavigator } from 'react-navigation'; import { createStackNavigator } from "react-navigation-stack"; import Splash from "./components/splace"; ...
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 ...
0
votes
0answers
14 views

How to update the Redux form fields on button click…I've used to forceUpdate in ReactJS but it doesn't work

I'm a starter to React and I'm trying to refresh my Redux form input data when the button is clicked..but the forceUpdate() method doesn't work...what's the problem with my code.. import React, { ...
0
votes
1answer
15 views

What is the advantage of running asynchronous code in middleware i.e. redux-thunk or redux-saga

I am just learning how to implement redux into my react projects and I am trying to understand the advantage of running asynchronous code in middleware for redux state changes. Why wouldn't we just ...
0
votes
0answers
20 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
0answers
18 views

React Dropzone Uploader not playing along with form upload to mongo

(New to stackoverflow so please correct me if I've seemed to miss something from CoC) (Unfortunately wasn't able to tag this under 'react-dropzone-uploader', since I don't have 1500+ rep points) I'm ...
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 ...
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 ...
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
2answers
28 views

How to correctly align comment using semantic UI in React JS?

To generate comment component using Semantic UI, I wrote the following code : import React from 'react' import ReactDOM from 'react-dom' const App = () => { return ( <div ...
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
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
19 views

How do i make my routes.map display my components correctly

It is something problem with my map below that is declared down in App.js because it worked before and i have my route array with all the components that i want to click on and choose from but i can'...
0
votes
1answer
19 views

How can I change the value of an object in react based on form data input by the user?

I am using react and trying to build a payment system using the paypal button v2 and need to let users input how much money they want to charge themselves. Currently the code that would handle this ...
0
votes
0answers
27 views

How do I avoid querying firestore in an indefinite loop when using geo queries based on the current position on a leaflet map?

I have a react component that should display an interactive map with markers showing places near the current map center location. I'm using leaflet to show the map, and the data of the places is ...
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
0answers
63 views

Cannot read property 'name' of undefined in react?

I am using react final form with material UI .when I am adding custom text field or material UI component I am getting this error Cannot read property 'name' of undefined here is my code https://...
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 ...
-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 ...
-2
votes
0answers
29 views

Javascript and react snippets in vscode issue [closed]

In vscode 'Javascript(ES6)_code_snippets' and 'ES7_React/Redux/GraphQL/React-Native snippets' snippets works just for few seconds. Later it doesn't show up. When i reopen the IDE, it will work for ...
0
votes
1answer
9 views

How to test the ProtectedRoute component. (Invariant failed: You should not use <Route> outside a <Router>)

I have built this component to create a ProtectedRoute component that can be used to check if the user is Authenticated and be redirected to the routes or be prompted to login. /* eslint-disable ...
0
votes
1answer
16 views

Issue mocking a Redux Store with Jest/redux-mock-store

I've been trying to mock a redux store which is inside a dependency module with no success as below: //configStore.js const store = createStore( combineReducers(reducers), undefined, ...
0
votes
1answer
27 views

How to mock a React Component with complicated logic

I am using a third-party React component which is proving really hard to test. Here is an example of what my component looks like. import { ThirdPartySelect } from 'thirdPartyComponents' function ...
0
votes
0answers
22 views

How to give iDs to dynamic fields in React-Redux?

I created a simple dynamic fields in React-Redux with a plus button to add as many field as I want (hobbies) of an already existing form. I'm using mongodb as a database and so I have this error that ...
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 ...
1
vote
1answer
40 views

Every axios request firing twice in react-redux app?

There are many similar question but nothing could help for me. Every Axios request is firing twice in my react redux node app. I am using node`s express framework. If I take login page example then ...
0
votes
0answers
28 views

Multiple timers in react-native

I have created a component, for example 'TimeComp' in react-native, which is connected to Redux Store. When this component is loaded via FlatList I want to set a loop as a timer. I use setInterval ...
1
vote
1answer
23 views

How to pass props to child component from parent component and receive it in child component using react-redux

My Parent component is like - Requestdetails component import React, { Component } from "react"; import TopBarComponent from '../../common/TopBar/topBar' export default class RequestDetailsComponent ...
0
votes
0answers
30 views

Typescript: react-redux, react-i18next HOC type interference in a .JS file?

I'm experiencing this really weird issue. I have a TypeScript react project running, with react-redux and react-i18next setup (the @types packages are installed too). Now I have the following ...
0
votes
0answers
15 views

Could not find router reducer in state tree, it must be mounted under “router”

after upgrade my redux packages i get an error like that: Error: Could not find router reducer in state tree, it must be mounted under "router" my store.js file is look like: import { createStore,...
0
votes
1answer
43 views

Incompatible action types in reducer

In my app, I have a number of different actions that may or may not affect the same part of the state. To simplify the example I created this small code: // @ts-ignore import { handleActions } from '...
0
votes
2answers
58 views

Is possible to modify the url without reloading a page?

Into my application, at a certain point, I receive some query params form a callback. I need to store them onto redux store and after that redirect, the user on a page and I need to modify the URL ...
1
vote
1answer
23 views

React native saga yield call is not working

I am trying to write an api by using redux-saga. I have my servicesSaga.js like this import { FETCH_USER } from '../actions/actionTypes' import { delay } from 'redux-saga' import { call, put, ...
0
votes
0answers
17 views

React authorisation based routing in conjunction with the business level routing

I’m currently facing issues with the permissions and blocking with a React Webapp UI, and I was wondering if anyone could help out. Currently, we use routing of the app, which handles three different ...
1
vote
2answers
35 views

Show External Component On Checkbox Click Between Two Stateless Component

Am a bit new to react and redux. I am trying to call/show another stateless component's div from parent component. For example, if I have the below code const funcA = ({key}) = > { return ( ...
0
votes
1answer
49 views

Assign resolve function from Promise to a variable

There's a snippet of code that I cannot seem to understand. There's a function that is declare empty at first: let dCredentials = (credentials: any) => {} Then this variable is later reasignned ...
0
votes
0answers
26 views

React props.auth.user is undifined when registering a user

In my project when I try to print the name of the user that just registered it shows undifined. When I register a user he is redirected to the dashboard page where is name should apear but it doesn´...
0
votes
1answer
40 views

ReactJS - Proper way to get a result of dispatch

For async requests, I'm using redux-saga. In my component, I call an action to recover the user password, it its working but I need a way to know, in my component, that the action I dispatched was ...