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
0 answers

react redux thunk not populating state object

im having an issue with my code, its not populating the state object when state action is being performed. im new with redux i have this code. so far that having an issue this is the statement that will called the props.action…
0
votes
0 answers

I'm trying to save accessToken to my reducer slice when I dispatch it to my reducer it is gone

const redirectURL = 'http://localhost:3000/'; const authorizePage = `https://accounts.spotify.com/authorize?response_type=token&client_id=${clientID}` +`&redirect_uri=${redirectURL}&scope=playlist-modify-public`; export const searchTerm =…
Abdulaziz
  • 1
  • 3
0
votes
0 answers

why Sometimes data comes in dropdown and sometimes it doesn't comes?

why Sometimes data comes in dropdown and sometimes it doesn't comes? dropdown's data comes on first time cloning, Sometimes it comes even after cloning for the second time. But when cloned for the third time, dropdown's doesn't get the options. …
0
votes
0 answers

How to make some variables available in a redux thunk

I have a redux thunk createTodoThunk. This thunk needs two variables accountIntId and todoListIntId required as placeholders to build the URL of the endpoint to call to create the todo. In practice, I need that an URL changes from this to this: -…
Aerendir
  • 6,152
  • 9
  • 55
  • 108
0
votes
0 answers

State not getting updated in redux

i am trying to generate an array of movies which is working correctly and the "result" which is being consoled has the genres id and the getGenres function has all the genres with id why is genres empty in when movies array is being created. export…
Fam fas
  • 17
  • 3
0
votes
1 answer

Why does my editor say "'await' has no effect on the type of this expression"?

Why does my editor (PHPStorm) say that I'm not gonna need 'await'? It works normally... Here's the code: export const fetchBoards = (): AppThunk => async function (dispatch): Promise { try { const { boards }: { boards: IBoardItem[]…
user19384667
0
votes
0 answers

Query in converting Plain Redux to REDUX TOOLKIT

Description of what I want to achieve : In my website, I want to show some alerts every now and then, maybe when user enters wrong email ID or passwords does not match etc. And I want to acheive this using redux. My Solution in Plain Redux: I am…
Nav
  • 93
  • 9
0
votes
1 answer

difficulty using store & reducer UnCaught Error: Actions must be plain objects

halo guy, i'm creating a project using redux react & i'm getting this err, which i'm not familiar with below is my code & err store const reducer = { auth: authReducer, msg: msgReducer, data: dataReducer } const store =…
Tosin Ayoola
  • 77
  • 1
  • 9
0
votes
0 answers

@angular-redux show state is undefined while fetching from ngRedux store

I am trying to read the configuration from store, and i have returned the default state in all the reducers still not able to figure out why do i get state as undefined, can anyone please guide on this below is the ts file line (we call below line…
0
votes
2 answers

How we can combine the selector in Redux?

Suppose that I want 3 data from 3 different reducers. In general I can do something like this!! const data1 = useSelector((state: any) => state?.reducer1); const data2 = useSelector((state: any) => state?.reducer2); const data3 = useSelector((state:…
0
votes
0 answers

In Redux toolkit, when creating an async operation with createAsyncThunk, when do you have to include 'thunkAPI' in the async argument?

In Redux’s createAsyncThunk I understand the second argument is an asynchronous payload creator. Please correct me if any of this is wrong. But if there’s any parameters, the arguments for async is supposed to be your param name and then ‘thunkAPI’,…
0
votes
0 answers

Redux not get the data after reloading page

I'm working on a react application where I try to fetch users' data from API. Below is the redux code: Users Slice Code `http://${process.env.REACT_APP_API_DOMAIN}/userProfiles` ).then((res) => res.json()) // return…
Shahid Khan
  • 103
  • 1
  • 2
  • 9
0
votes
1 answer

Queue and pause Redux actions while offline

I want to pause all dispatched thunks when I am offline and resume when I'm back online. Is createListenerMiddleware a good option for this? I could create like a seperate redux slice to save the dispatched actions and just redispatch them, but this…
uloco
  • 2,283
  • 4
  • 22
  • 37
0
votes
1 answer

Thunk Middleware: how/why does action creator have access to dispatch when it's not passed in?

For reference, this is the origin of the below screenshots: https://github.com/gopinav/React-Redux-Tutorials/blob/master/redux-demo/asyncActions.js Looking at the fetchUsers action creator function in the below screenshot, how is dispatch passed…
brunshte
  • 153
  • 2
  • 9
0
votes
1 answer

redux toolkit dipatching buildercase twice actions

I am trying to figure out why during refresh does the dispatch action gets run twice and the endpoint is also been called twice. This is my slice extraReducers: (builder) => { builder.addCase(fetchAppointments.pending, (state, action) => { …
chewie
  • 529
  • 4
  • 17