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

React,Redux: Show all posts

I'm a begineer to React, redux and web development. I'm making a CRUD application using JSON placeholder as dummy backend , react and redux for showing posts. I want to render out all the posts form JSON placeholder and simply display…
0
votes
0 answers

Using redux for editing fields without redux-forms

I am making a page which has many editable input fields. I am using redux-toolkit and redux-thunk for this. I am fetching data from api and put them into redux store. First render of component I want to reflect data in the store to the component's…
erondem
  • 482
  • 1
  • 11
  • 24
0
votes
0 answers

TS2322: Type 'IToken | undefined' is not assignable to type 'WritableDraft | null'

Inside of Redux toolkit thunk I'm making axios call to server and recieve data of type IToken. I also created axiosClient and user function. Problem is with typescript. When I make axios call inside of thunk instead of putting it in seperate file…
Paul Gutsal
  • 107
  • 2
  • 12
0
votes
2 answers

Uncaught Error: Actions must be plain objects. Instead, the actual type was: 'Promise' React-Redux

I have a client-side problem. The server side is working fine, and the deleteCourse method deletes the course, but I get the error you see in the title on the client side. I am not sure what is going on. If I need to provide something else, just ask…
0
votes
0 answers

may i use this code for finduserDetail in react using redux-thunk dispatch to calling function

This code for finduserdetail by hitting function with help of dispatch method and passing (match.params.id) not working, even function not called as I know on dispatch method it should be called how may I call this so that our stat could be update…
yashvant
  • 1
  • 1
0
votes
1 answer

How to make a redux dispatch action async using redux toolkit

I'm trying to make redux dispatch action async using redux toolkit. I'm doing this to handle UI freeze caused due to redux state update (using setFilterInfo reducer). While searching for a way to do it, I came across createAsyncThunk. However, all…
manmo
  • 13
  • 3
0
votes
0 answers

how do i navigate to another page in redux-toolkit thunk

I am using redux-toolkit and I need to navigate to another page when user logs in. However I cant use the useNavigate hook because it can't be called outside any custom hook or function component. Any workaround? export const LogUserIn = (email,…
0
votes
2 answers

having problem in set payload in redux using createSlice() and createasyncthunk()

component where I am using the state data const { contentTitles: ContentTitles } = useSelector((state) => state); const dispatch = useDispatch(); useEffect(() => { const fetchData = async () => { const response = await…
Sharjeel shahid
  • 202
  • 1
  • 2
  • 11
0
votes
2 answers

ReduxSaga makes my website re-render infinite

Im using Redux-Saga and Redux-Thunk, this is store I have configured, but it makes my website re-render infinitely. Can u tell me what should i do to solve that? Thank u. Store.js import { createStore, applyMiddleware, compose } from 'redux' import…
trungvs
  • 13
  • 3
0
votes
0 answers

Type '{}' is not assignable to type 'string', error with axios Redux-thunk

So I created async Thunk function, and in try{}catch{} block I recieve error, and then with method rejectwithvalue I send it to extraReducer, rejected case. I do recieve it, I can console.log(action.payload), yet I cannot assign payload value to…
Paul Gutsal
  • 107
  • 2
  • 12
0
votes
0 answers

Why Redux-Thunk Payload Array Data are Forcefully Sorted

How to avoid the array data response in the fulfilled payload to be forcefully sorted? The result is ['mango', 'apple', 'banana'] in export const fetchList = createAsyncThunk('listing', async () => { const response = await HttpGet('listing'); …
0
votes
0 answers

How to use recursion in createAsyncThunk?

Can you write example? Because my code is not working. As I got, I cannot write another async function inside.
Ferel Ultra
  • 45
  • 1
  • 9
0
votes
1 answer

Getting undefined "type" error when using createAction from redux-api-middleware library

I am trying to use the createAction function but am met with the following error: Uncaught Error: Actions may not have an undefined "type" property. Have you misspelled a constant? I'm not sure why I am getting this but I am assuming it has to do…
0
votes
0 answers

The problem of reading data from the store at the first start

I have a weather application that, when launched through a request, determines the city by IP and saves it to the store, and immediately after that the weather for this city should be displayed here is my code const { isPending, days, error,…
qwfrjk
  • 71
  • 2
  • 10
0
votes
0 answers

Getting "Uncaught TypeError: Cannot add property itemsPrice, object is not extensible" error

I am trying to add cart.shippingPrice, cart.taxPrice, cart.totalPrice but getting Uncaught "TypeError: Cannot add property itemsPrice, object is not extensible" error because of it. I am following a tutorial and instructor's code is working fine but…