Questions tagged [redux-thunk]

Thunk middleware for Redux. Redux Thunk middleware allows you to write action creators that return a function instead of an action. The thunk can be used to delay the dispatch of an action, or to dispatch only if a certain condition is met. The inner function receives the store methods dispatch and getState() as parameters.

Redux Thunk middleware allows you to write action creators that return a function instead of an action. The thunk can be used to delay the dispatch of an action, or to dispatch only if a certain condition is met. The inner function receives the store methods dispatch and getState() as parameters.


Related tags

2622 questions
0
votes
1 answer

Facing error in Redux thunk middleware rootReducer

I have implemented OAuth with MSAL-React (Microsoft authentication to enable SSO) in my application. I want the accessToken acquired from MSAL to be accessible across the pages. So, I thought of using redux to store the accessToken. However, I could…
Lakshmi
  • 85
  • 12
0
votes
1 answer

react-redux asynchronous get method been called multiple times

i'm working on my react blog project and i'm making a get request using an api using (redux-react) but my problem is that the function is been called continuously, instead it been called once below is my code and image showing the continuous api…
0
votes
1 answer

Flutter redux store.dispatch(...) resetting the value of another redux state variable

The scenario is, when the app opens, we need to do two REST API calls, Get User Function List API call Get Chat Bubble List API call We have two redux state variable userFunctionList chatBubbleList state.dart class AppState { final List…
0
votes
1 answer

Redux thunk action is fulfilled when it should have been rejected

I'm dispatching a thunk action that I expect to be rejected, but it's fulfilled instead...
0
votes
1 answer

how to reset errors in a react redux application with a common error displaying component

I am new to redux so apologies if it's a stupid question. I have a react application and I am adding redux store to it. I am using thunk middleware to execute async code to get/save data from the backend. I have this below in…
Toseef Zafar
  • 1,601
  • 4
  • 28
  • 46
0
votes
1 answer

How to reload data from api in Redux

when I lose in a hangman I want to reload my data in the API so that a new password appears. Unfortunately I have no idea how to reload it without reloading the whole page, is it even possible to run the api again on a button click for…
Daniel
  • 17
  • 4
0
votes
2 answers

React toolkit redux extraReducers not working

When action ends extraReducer is not being called I'm trying fetch for this url, which will return a list of items to me, fetchItems method is called by dispatch, but at the end, the extra reducer at line:55 is not called. Maybe I'm not undestanding…
Biel
  • 1
  • 3
0
votes
0 answers

reducer not getting called after dispatch when using mock service worker

reducer not getting called on dispatch in - redux + thunk + react testing library + MSW all details in https://github.com/reduxjs/react-redux/issues/1975 after dispatch reducer should get called and i should be ale to assert the mocked data returned…
0
votes
0 answers

How to update State on category bases in react redux toolkit?

import React from 'react' import Products from '../components/Products' import { setCategory } from '../app/productSlice'; import { useDispatch, } from 'react-redux' const Home = () => { const dispatch = useDispatch(); const handleFilter =…
0
votes
0 answers

getting back just axios data in redux thunk not a array list

I want to get back data from axios Api into redux thunk just like this one axios .post(`/metrics`, data) .then((res) => { console.log(res.data); insted of data array how do I that
Ahmad
  • 1
0
votes
2 answers

React Redux Toolkit Doesn't Dispatch Async Thunk

I am using Redux/Toolkit and I want to use the Async Thunk for authentication processes. But it returns an error when I'm trying to dispatch the function. What should I do in this case? It's the first time for me to use Async Thunk, so I don't have…
yusufcode
  • 391
  • 5
  • 19
0
votes
2 answers

I can't output data from json

I am developing a website on the stack: React, redux, typescript. I can't output a nested array with data from a data object in JSON My code: app.tsx const App: React.FC = () => { const {tasks, loading, error} = useTypedSelector(state =>…
Vhipper
  • 15
  • 5
0
votes
0 answers

How to Call API In NextJS Using Redux With SSR?

Need One Help i am trying to call api in nextjs using redux(Here,SSR is not possible) and getServerSideProps(Here, SSR is Possible but without redux) in both case API Called Successfully. If i used it individually bot are working well but now i want…
0
votes
1 answer

have a problem to set user in my state , do it with createAsynceThunk from redux-toolkit

im dispatch the user from my component to the setUserAsync in my userSlice folder, but when im dispatch it, the user even not came to the createAsyncThunk in the console.log , my goal is to save the user in my state , and in the local storage. im…
Amit Amar
  • 51
  • 1
  • 8
0
votes
0 answers

Why redux async thunk work 3 times but returns 2 time undefined on my code

i get data from an api, when i submit the form send my form data to redux async thunk 3 times but last 2 sending, form data go as undefined to async thunk her is my thunk function export const getSearchMoviesAsync = createAsyncThunk( …