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 Native - createAsyncThunk with Axios

I try to use 'redux toolkit' to create async function for my React Native app. below are my createAsyncThunk function: export const signin = createAsyncThunk( "signin", async (dispatch, getState) =>{ return await…
sooon
  • 4,718
  • 8
  • 63
  • 116
0
votes
1 answer

why useSelector return undefined?

I can't figure it out why it's returning undefined, when i'm using the useSelector In console log it showing Uncaught TypeError: movies.results is undefined error logmovieLising.js(without render movies) console.log store.js import…
0
votes
1 answer

How make make await as useDispatch

Can you please explain why await on dispatch has no effect?.Use dispatch is synchronous by default. But is there any way to make it to async? I have one issue by using dispatch and createAsyncthunk.I think it halts the render of other components. I…
0
votes
1 answer

How to dispatch post data object using async thunk redux axios middleware

I am trying to dispatch a post of an object data using async redux axios middleware. I am getting 400 https response prob due to formatting. Here is what I have for my code. Any feedback is great! import { createAsyncThunk } from…
Bebe
  • 77
  • 1
  • 14
0
votes
1 answer

Following a tutorial: Uncaught TypeError: Cannot read properties of undefined (reading 'name')

here i am returning a jsx element the element renders and API is hitting but when i use product.name it's returning undefined import { useAlert } from 'react-alert'; import { useDispatch, useSelector } from 'react-redux'; import {…
0
votes
1 answer

Redux: How to create a new Redux store for separate child react components

I have a react component I'm importing into my project. Both my main project and the component use separate redux stores. Initially the component was just imported once and this had no issue, but when it's imported twice it uses the same redux store…
RRRRRR
  • 31
  • 6
0
votes
1 answer

Questions about Redux Thunk Middleware

i really need help. I'm confused about how should i manage my async API Calls and error handling using redux thunk middleware. Option 1 Send essential info to redux thunk middleware (newJobInfo) and ALSO other functions to manage my component state…
John Doe
  • 13
  • 2
0
votes
1 answer

Why is the thunk function in React Native Redux not working, but the action function does?

I'm trying to build a React Native app with Redux-thunk I built the action and the reducer and I created the porvider and store and I called the action inside the useEffect in the component. The problem: The problem is that the data does not reach…
0
votes
1 answer

Why I can execute dispatch() method without using an instance of a Redux store(store.create())?

I have been using Redux on some of my projects by following some tutorials, in order to make API calls(write action creators that return a function instead of an action) we use redux-thunk. I don't understand why inside this action creators…
petu
  • 13
  • 1
  • 3
0
votes
1 answer

React native component not updating its state while rendering

I am trying to render single book one by one from redux when click on next book button. I achieved it by using below code but issue is when i try to add some book in bookmarks and click on next book then next book star also showed as orange (which…
0
votes
2 answers

Using React and Redux, how would you clear an input field after a successful redux-thunk completion?

Let's say you are using react and redux and you have the following elements on a page: Input field to write something A save button to write your text async to the DB The expected flow is that the save button should dispatch a save redux thunk to…
cbdeveloper
  • 27,898
  • 37
  • 155
  • 336
0
votes
0 answers

Check the render method of 'customComponent'

I have made a Login page in React Native with React hooks along with redux thunk connect. In that Login Page, i have import a LoginForm as customComponent and I have properly export and import that component.But still it produce Element type…
0
votes
1 answer

Is dispatch function returned from useDispatch hook synchronous with async thunk?

Async thunk: const getMovies = createAsyncThunk('recommended/getMovies', async () =>{ const result = await api.getRecommendedMovies(); console.log('first') return result; }); Function that uses dispatch function from useDispatch…
moze
  • 322
  • 1
  • 5
  • 14
0
votes
1 answer

React Redux toolkit how to implement search

Redux newbie here. I'm trying to implement search functionality in my React App. I'm fetching data using the thunk middleware. Here is my slice code: export const fetchAllJobs = createAsyncThunk( 'job/fetchJobs', async () => { const…
Tajmin
  • 353
  • 1
  • 7
  • 23
0
votes
2 answers

I want to use redux saga instead of redux thunk. Will this cause any problems in future in my application?

I'm usually used to React Saga so I want to use Redux Tool Kit and Saga. Butt is confused about whether this will be a problem later.
Rasel
  • 1
1 2 3
99
100