Questions tagged [react-thunk]

65 questions
0
votes
1 answer

React-Redux why when I set up a middleware the object is returned twice when is called

This is the 2 objects when a make a axios fetch and then set the response.data into the store My Question is if this is normal, because the default State is empty, so first return the empty object and then the filled object, how can i solve tha or…
0
votes
1 answer

react-native react-thunk triggering on initial component load and any keypress on an input

I'm a bit new to react, react-native, react-redux, and react-thunk and am encountering this strange issue which I can't explain. I have a sign-in component that uses a thunk to authenticate a user. I mapDispatchToProps and apply it to the component…
kisonay
  • 331
  • 5
  • 14
0
votes
1 answer

Multiple actions in single dispatch (React-Redux Hooks)

I'm using react-redux hooks to write a login/logout system. Currently i'm facing a problem where inside the logout() & login1() will only run the first dispatch only. Did some research found that redux-thunks might can solve this, but get confused…
OMG
  • 3
  • 2
0
votes
1 answer

A cross-origin error was thrown while working on asynchronous http calls using react-thunk in codesandbox.io

I am practicing on API calls using react-thunk. but i am getting the following error. proxyConsole.js:64 Error: A cross-origin error was thrown. React doesn't have access to the actual error object in development. For practicing purpose i…
Thriveni
  • 3,451
  • 2
  • 11
  • 10
0
votes
1 answer

useEffect Hook not firing function enclosed inside it

I have the following component in my reactjs application: import React, { useEffect } from 'react'; import { Helmet } from 'react-helmet'; import { connect } from 'react-redux'; import MovieList from '../components/MovieList'; import styled from…
Alexander Solonik
  • 8,718
  • 13
  • 56
  • 133
0
votes
0 answers

Make redux with redux-thunk action synchronous

I need to make redux action and then use state to update my url. I have tried to make a promise: const opa = (type: string, checked: boolean) => ( dispatch: any, getState: any ) => Promise.resolve().then(() => { return…
domanskyi
  • 445
  • 1
  • 3
  • 11
0
votes
1 answer

Should React component method reference be cleared in component unmount?

lets assume something lile this: handleClick = () => { dispatchThunkAction(this.someMethod), } someMethod = () => { //do something } dispatchThunkAction fires http request. once done, thunk action calls back someMethod thats passed to…
dee zg
  • 10,582
  • 7
  • 33
  • 59
0
votes
1 answer

Restoring column state of Ag Grid with react redux

I am using Ag Grid in react+redux application. I need to make column state of the grid persistence. In other words everytime when user make changes with columns(order, sorting, hide\show, etc), application must save column state to DB. Then when…
KozhevnikovDmitry
  • 1,465
  • 10
  • 24
0
votes
0 answers

I have been getting loop on my error page when i click retry

When a new User register for the first time, and get an error during submition, This workas expected but after the user tap retry it just loop to error page (RegistrationFailure.js) but behind the scene there is an activity going on. I need help…
dilas
  • 11
  • 4
0
votes
1 answer

How to fix an "Could not find 'store'" error in React-Redux?

I'm trying to add React-Router to my application, but getting an error: Here is a code
MIkle
  • 69
  • 1
  • 7
0
votes
2 answers

How to make infinite scroll fetch function work in order

I want to infinite scroll to fetch any items, the brief step is: 1) scroll at the end of screen. 2) use redux to update items pageIndex. 3) use componentDidUpdate to catch this redux action. 4) append the fetch items to the end of items'…
ccd
  • 2,488
  • 1
  • 15
  • 38
0
votes
1 answer

Why don't chaining dispatch Redux-Thunk

Why don't chaining dispatch Redux Thunk? Only work first dispatch and second dispatch is not working. Store: const store = createStore(reducers, loadState(), applyMiddleware(thunk)); Action: export function doSomething(name) { return function…
mrkacan
  • 53
  • 8
0
votes
1 answer

(React/Redux) Component State not being update with reducer and mapStateToProps

My component State is not being update with Reducer, in mapStateToProps get Reducer State well and appears in the props but shouldn't it update the State of my Component for it to re-render? In Reducer returning the state {...state,…
H.C
  • 451
  • 4
  • 22
0
votes
1 answer

Promise based Action succeeds, data gets resolved but i get an error message

So i'm trying to build this action on a react and i need it as a promise. The action succeeds, i receive the response from the server but i also get an error saying: VM89852:98 Uncaught TypeError: Cannot read property 'then' of undefined. action:…
iizmad
  • 61
  • 1
  • 4
0
votes
0 answers

React router delay untill redux has loaded data

I'm trying to make a WordPress theme, with React + Redux. I'm using this Wp + React + Redux theme as an example: https://github.com/jackreichert/a-wp-react-redux-theme. On the homepage I fetch all the posts with the WordPress API link. When I click…
coder14
  • 213
  • 2
  • 13