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…
![](../../users/profiles/6270356.webp)
Justin Zuñiga Torres
- 89
- 3
- 16
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…
![](../../users/profiles/1298339.webp)
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…
![](../../users/profiles/12484934.webp)
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…
![](../../users/profiles/2801843.webp)
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…
![](../../users/profiles/4381665.webp)
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…
![](../../users/profiles/10118025.webp)
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…
![](../../users/profiles/2736919.webp)
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…
![](../../users/profiles/2651950.webp)
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…
![](../../users/profiles/8089164.webp)
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
![](../../users/profiles/9184012.webp)
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'…
![](../../users/profiles/9768260.webp)
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…
![](../../users/profiles/5455743.webp)
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,…
![](../../users/profiles/3375731.webp)
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:…
![](../../users/profiles/6406730.webp)
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…
![](../../users/profiles/5449101.webp)
coder14
- 213
- 2
- 13