Questions tagged [react-thunk]

65 questions
1
vote
1 answer

Component not being updated after state is changed in reducer

I would like to display the error to my user. An error is thrown and the error and message are updated in the reducer by the action. But for some reason I can't get the error or message to display for the user. Is there something wrong with the…
Roro
  • 297
  • 5
  • 17
1
vote
3 answers

react/api - how to parse and map an array inside of api response

I'm trying to parse and map through the array "items" inside of this api response [ { "id": "", "portal_account_id": "", "platform": "", "current_date": "2018-07-30T11:27:16+02:00", "email": "", "items": [ { …
develop05
  • 397
  • 4
  • 15
1
vote
1 answer

Uncaught TypeError: dispatch(...).then is not a function

Container component import { connect } from 'react-redux'; import { signUpUser } from '../actions/userActions'; import Register from '../components/register'; function mapStateToProps(state) { return { user: state.user }; } const…
Pravin Pawar
  • 2,459
  • 2
  • 32
  • 37
1
vote
3 answers

Props only render after I refresh the page

I have 100+ to render. I'm fetching it using NodeJS backend, passing the data to the frontend, and using Redux to React components. I have many components that render fewer data and everything works great, but when it comes to this component,…
Dzenis H.
  • 4,658
  • 2
  • 17
  • 39
1
vote
1 answer

Redux thunk in react native

I'm getting and error on createStor that I'm not understanding why import { createStore, applyMiddleware, combineReducers, compose } from 'redux'; import thunk from "redux-thunk" import promise from "redux-promise-middleware" import * as reducers…
1
vote
0 answers

React - control is not going inside action

I am developing react-redux application where i am calling action by using the dispatch but its not working. I am using redux-thunk also. Component code is below class UpdateProfileForm extends Component { constructor(props){ super(props); …
Lionel Dcosta
  • 138
  • 2
  • 13
0
votes
1 answer

Typescript types for unsubscribe from firestore and Redux-Thunk

I have a Thunk Action that looks like: export const doTestCall = (teamId:string): ThunkAction<()=>void, RootState, null, MoodAction> => { return dispatch => { const unsubscribe = db.doc("id").onSnapshot(doc =>{ //whatever …
0
votes
2 answers

React @redux/toolkit not re-rendering component when state is updated

Codesandbox: https://codesandbox.io/s/condescending-wiles-funk0?file=/src/App.js Problem: When I update the state of my store the components are not re-rendered. In the above example you can see from the console that the data is correctly fetched,…
devamat
  • 1,529
  • 1
  • 15
  • 32
0
votes
1 answer

Infer Type of asyncThunk action

I needed to use useAppDispatch to be able to await on dispatching async thunk actions interface AppDispatch { (action: T): T extends Function ? Promise : T; } function…
NavyCody
  • 475
  • 2
  • 10
0
votes
1 answer

Can't export action creator to component mapDispatchToProps method

In my action file I create a fetchMethod export const requestEmbedToken = () => (dispatch) => { return axios.get('http://localhost:7071/api/getTokens') .then(response => { console.log("token embed", response) …
infodev
  • 2,965
  • 10
  • 36
  • 87
0
votes
1 answer

blank page when deploying react-app into firebase hosting?

i have a problem related to deploying my react-app into firebase hosting , my react app is created with create-react-app, the build folder is ready and and i have successfully deployed my app to firebase , but nothing shows up , here is my…
0
votes
0 answers

How to use actionCreators with only Hooks in redux-thunk

I'm trying to use redux-thunk to getData asynchronously using hooks in redux. I can get it all working with connect() but useSelector/useDispatch is where I can't figure it out. codesandbox import React, { useEffect, useState } from "react"; import…
Advent
  • 35
  • 1
  • 6
0
votes
2 answers

Error thrown by Firebase is caught in then() of redux-thunk action

Firebase spits out an error if a request takes too long to resolve due to slow internet connections. Here is the error: @firebase/firestore: Firestore (7.9.2): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error:…
dillon
  • 71
  • 5
0
votes
1 answer

React app converted to react-native - problem with react-redux and react-thunk

I converted this application https://codesandbox.io/s/3y77o7vnkp <--Please check this link into my react-native app and it works perfect. Since I implemented redux and redux-thunk I have a problem with fetching data. There is a problem. I converted…
0
votes
0 answers

In React / Redux, how is race condition Ajax responses handled?

Does any existing react/redux related package handle Ajax race-conditions? If the user clicks on "Blue" or "Peter", and the screen is supposed to update info for the product to blue or show messages from Peter. But the server is slow, and after 3,…
Jeremy L
  • 3,580
  • 5
  • 36
  • 60