Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
63 views

Await a dispatch thunk before executing some code is working but compiler complains

So I was tasked to fix some buttons so that there is a loading spinner present when they are clicked. The problem is that my solution is not ideal since intellij complained that I have unessesarry ...
physicsuser's user avatar
1 vote
0 answers
31 views

useEffect and dispatch with asyncThunk not working. What am i doing wrong? [duplicate]

In my code below i am using useEffect with dispatch and inside the dispatch function I am using an asyncThunk. If i console.log, in the fulfilled function provided by the thunk, the user then i get ...
user26607863's user avatar
1 vote
1 answer
73 views

Redux thunk - Uncaught TypeError: middleware is not a function

I am a complete beginner, I'm following a tutorial on redux thunk and keep getting this error: redux.js:642 Uncaught TypeError: middleware is not a function at redux.js:642:1 at Array.map (<...
MrsSour's user avatar
  • 13
-1 votes
1 answer
83 views

unexpected behaviour of dispatching action in redux

I have the following async thunk function: const loadProject = createAsyncThunk( '[Project API] Load Project', async (project: IKProject, { dispatch }) => { await kProjectService....
Y_Moshe's user avatar
  • 432
0 votes
1 answer
44 views

Using Redux Persist [duplicate]

I was using Redux Toolkit and tried to use Redux Persist but on terminal it shows this. A non-serializable value was detected in an action, in the path: `register`. Value: [Function: register] Take a ...
kodeater's user avatar
0 votes
0 answers
21 views

Err: The requested module 'redux-thunk' does not provide an export named 'default' [duplicate]

I am currently learning redux and encountered an issue with importing redux-thunk in my Node.js project. I’m trying to set up middleware for my Redux store, but when I attempt to import redux-thunk, I ...
elclasico's user avatar
0 votes
0 answers
14 views

impoerted thunk was not found in redux-thunk [duplicate]

i see this error when i start the project "ERROR in ./src/redux/reducers/configureStore.js 7:57-62 export 'default' (imported as 'thunk') was not found in 'redux-thunk' (possible exports: thunk, ...
user25315893's user avatar
1 vote
1 answer
88 views

Redux toolkit TypeError: Cannot read properties of undefined (reading 'type') while fetching data with redux thunk

I need to fetch data from my API with redux thunk and axios. but I'm facing this error inside my console. In this case I have a marketSlice and I want to update my state.market with API Data. ...
Hero's user avatar
  • 148
1 vote
1 answer
498 views

I am getting an error while trying to import 'thunk' from 'redux-thunk' [duplicate]

I am new to React and Redux, and I am trying to build a webapp (authentication system) using React and Django. I am following a tutorial to do that, with this github directory. When I try to import ...
Farooq Ahmed's user avatar
1 vote
2 answers
858 views

import thunk from `redux-thunk` not working in stackblitz

Now I am trying basic redux logic in Stackblitz platform. import { createStore, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; import { composeWithDevTools } from 'redux-devtools-...
Gardener1688's user avatar
0 votes
1 answer
122 views

How do you mock the resolved value of an awaited dispatch

Let's say I have a thunk: import fetchSomeData from '/path/to/fetchSomeData' const myAction = () => async dispatch => { ... const data = await dispatch(fetchSomeData()) // `...
noblerare's user avatar
  • 11.7k
1 vote
1 answer
280 views

Redux Toolkit middleware does not work to handle successful asynchronous actions

I've integrated into my Next.js app some of my own middleware into the Redux-Toolkit store using configureStore. Middleware is designed to handle asynchronous actions such as fetchAccounts/fulfilled ...
Alexander Gnetov's user avatar
-1 votes
1 answer
114 views

Server Error Error: middleware is not a function WHEN I use Redux in NEXTJS

When I run program, it appears error "Server Error Error: middleware is not a function". I don't know why it happened. How can I fix this error? This is my code in store.js import { ...
klng's user avatar
  • 3
1 vote
1 answer
82 views

useSelector value is still null inside handleSubmit button in React

My code flow is that a user fills the form and submits it which goes to action calling the API and then it returns the postId and stores it in the reducer. Now my main React component has useSelector ...
kheman garg's user avatar
0 votes
0 answers
198 views

Argument of type 'AsyncThunkAction<any, void, AsyncThunkConfig>' is not assignable to parameter of type 'AnyAction'

iam using react-Redux-Toolkit + createAsyncThunk . I'm asking this question because an error occurred during development. categorySlice.js: import { createSlice, createAsyncThunk } from "@...
eslam wael's user avatar
0 votes
1 answer
36 views

State not updating after dispatching createBlockSession async thunk

Title: Redux Toolkit - State not updating after dispatching createBlockSession async thunk I'm working on a Redux Toolkit project where I have an async thunk createBlockSession that is supposed to ...
A Mehmeto's user avatar
  • 1,969
1 vote
1 answer
337 views

Getting TypeError: middleware is not a function

I am learning Redux, so wrote below logic by following online resources, but it throws this error: /home/sssawant/Sarvesh/notes_fullstack/frontend/React_notes/redux_demo/node_modules/redux/dist/cjs/...
Sarvesh Sawant's user avatar
0 votes
1 answer
366 views

How can I migrate from redux-thunk 2 to 3 when using redux-mock-store 1.5.4?

With version 2.x.x of redux-thunk and redux-mock-store 1.5.4 this code works: import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; const mockStore = configureMockStore([...
WillyC's user avatar
  • 4,665
0 votes
1 answer
135 views

Error: Actions may not have an undefined "type" property. You may have misspelled an action type string constant

I'm trying to login and signup in react. using react-redux, thunk v3.1.0, but getting error my auth.types.js file include Auth.action.js include auth.reducer.js include store.js has [![enter image ...
Vivek Nemade's user avatar
1 vote
1 answer
36 views

Is creating Redux thunk action and reducer that have no link to redux state and never change it an anti-pattern?

Could there be any rational reason to create a Redux thunk action and reducer pair for operation that seems to have zero relevance to redux state and the reducer never modifies the state, but instead ...
Vka's user avatar
  • 341
0 votes
0 answers
19 views

Unexpected behaviour when updating entity with Firebase RealTimeDB+Redux Toolkit

I am building a kanban board. When I move a card from one lane to another, I expect the card to be updated with dropped lane_id; however, either my cards become duplicates or do not update as expected....
Halit D's user avatar
  • 74
0 votes
0 answers
17 views

Prevent Audio Overlap in Thunks with Redux Toolkit

I'm working on a React project where I have a logic flow for checking answers in a language learning app. Each step of the process involves playing some audio. My issue is that the audio from ...
deadant88's user avatar
  • 1,008
1 vote
1 answer
197 views

How redux thunk payloadCreator callback function without parameters should be handled?

My app needs to fetch settings in startup. It doesn't need any parameters because it fetches everything. There haven't been issue before adding rejectWithValue so that actual status or error can be ...
char m's user avatar
  • 8,296
1 vote
0 answers
42 views

How to bypass this error "Actions must be plain objects. Use custom middleware for async actions." when testing with jest and without thunk? [duplicate]

I know it may seem duplicate, but I find the previous answers outdated. Before diving into the code, let me explain what I am doing. I'm having a login page. After clicking of the login button, I'm ...
Liviu Sosu's user avatar
  • 1,549
0 votes
2 answers
2k views

TypeError: middleware is not a function (it is undefined)

When I am integrating my React-Native app with Redux-Thunk I got this error: TypeError: middleware is not a function (it is undefined) I already tried everything on another stack overflow case but ...
Kirito's user avatar
  • 1
1 vote
1 answer
228 views

How error handling with redux thunk + fetch API should be implemented?

Somehow I didn't find working example for the most basic case. I took example e.g. from here. State: interface AppUserState { userId: string | undefined; user: User; status: 'idle' | 'pending' | ...
char m's user avatar
  • 8,296
0 votes
1 answer
651 views

How to batch multiple dispatches in redux-toolkit / redux?

I am using redux-toolkit in my react application. I use useSelector & useDispatch in the react components to manage the states the component controls. Outside the react component, I also call the ...
A.B.'s user avatar
  • 89
1 vote
1 answer
301 views

createListenerMiddleware to trigger when extraReducer has job done?

I have a Redux createListenerMiddleware defined in store.ts: export const listenerMiddleware = createListenerMiddleware() listenerMiddleware.startListening({ actionCreator: myAction, effect: (...
armaka's user avatar
  • 264
12 votes
1 answer
19k views

I get an error export 'default' (imported as 'thunk') was not found in 'redux-thunk' (possible exports: thunk, withExtraArgument) [closed]

I use "react-redux": "^9.0.4", "react-router-dom": "^6.21.1", "react-scripts": "5.0.1", "redux": "^5.0.0", "redux-...
Ujang Aripin's user avatar
1 vote
2 answers
80 views

Problem with Redux Thunk ( could not run function in reducer)

I have a problem with redux-thunk (redux-toolkit) , when I dispatch action logIn, console.log is working but this function Auth in apiInstance.ts file is not working Here are my set up store and ...
dark123's user avatar
  • 23
0 votes
0 answers
258 views

Dynamic endpoint in Redux Toolkit Query based on state

In our system a user can be part of many organisations. Some of the endpoints we hit reflect this, for :org/users, :org/tags etc. When making requests, the endpoint should change according to the ...
shennan's user avatar
  • 11.6k
1 vote
1 answer
91 views

Firebase authentication Redux useSelector

I want to redirect to the next screen when signIn succefull, however I'm having issues with the redux implementation. I'm able to complete the signIn/signUp and get the current user but in the file ...
Carlos Eduardo Diaz Torres's user avatar
1 vote
1 answer
2k views

getting TypeError: middleware is not a function in the terminal

I'm trying to implement a simple asynchronous API call in my Javascript application with Redux. Folder1\REDUX-DEMO\node_modules\redux\dist\cjs\redux.cjs:407 const chain = middlewares.map((middleware) ...
donjoe21915's user avatar
1 vote
1 answer
56 views

Actions Must be Plain Objects - React Error

Actions must be a plain object error. The Edit button on the projectList component should trigger a slide out window that displays the details of the project and allows the project to be edited. Once ...
Lewis Northcott's user avatar
1 vote
1 answer
327 views

Redux Toolkit typescript error when inyecting extra argument in Thunk Middleware

I'm trying to customize the Redux Toolkit`s included Middleware to add an extra argument. This extra argument is an implementation of a Repository. When I configure the store I add that extra argument:...
Ale's user avatar
  • 2,344
3 votes
1 answer
140 views

Redux Toolkit AsyncThunk dispatch

Can I access dispatch inside extraReducers? I want to dispatch action based of the asyncThunk function, if it failed or completed. const todosSlice = createSlice({ name: "todos", ...
Nikon George's user avatar
0 votes
1 answer
104 views

Using React Redux Toolkit I can't figure out the correct Typescript syntax for defining a thunk function returning a value

I'm using typescript in a React Redux Toolkit project. Creating an Async Thunk action function that should return a boolean I got stuck trying to devise the correct Typescript syntax for it: export ...
Sammybar's user avatar
0 votes
0 answers
170 views

Race condition using redux toolkit dispatch

I am trying to conditionally navigate dependent on whether the logged in user has completed onboarding or not. In the below function the logic doesn't appear to await the dispatch for long enough (or ...
deadant88's user avatar
  • 1,008
0 votes
1 answer
158 views

My dynamic content is not working in react

I'm new to React and currently facing an issue in my application. I have a component derived from a template that I'm converting to JSX. To incorporate existing JavaScript logic, I've placed it within ...
Hammad Ramay's user avatar
0 votes
1 answer
397 views

TypeError with redux - thunk : middleware is not a function

I am using applyMiddleware from redux which takes middleware as a parameter and I have passed thunk but somehow I am not able to resolve this issue related to middleware is not a function. Below is ...
Mustakim Sayyed's user avatar
0 votes
2 answers
233 views

Redux Thunk remains "fulfilled" even when I return a Promise.reject

I've been using Redux for few time and i'm struggling with a Thunk answer... In my slice, I'm calling an async function "handleBoxDeliveryAsync" extraReducers: (builder) => { builder ...
Ashitaaka's user avatar
1 vote
1 answer
263 views

A action from one slice is changing the state of another slice using redux toolkit

I'm using redux toolkit. I have different slices and they have their own states. I have a slice roles import { createSlice } from '@reduxjs/toolkit'; import { getAllRoles } from './roleActions'; ...
Muhammad Naeem's user avatar
0 votes
1 answer
506 views

How do I dispatch an action inside setTimeout in createAsyncThunk?

I am learning how to use createAsyncThunk. I have created a simple counter app. It has an add and an subtract button. On clicking those buttons, the counter value with increase or decrease accordingly....
Gautham Muralidharan's user avatar
1 vote
3 answers
96 views

How to call async function from within another component in reac js redux web application?

I have the code below but it gives error: const fetchData = (name) => { return async (dispatch) => { dispatch(fetchDataRequest()); await axios .get(url) .then((...
ace's user avatar
  • 12k
1 vote
2 answers
62 views

dispatch does not work in React Redux for authentication

I call register, the function is executed, but it's internal dispatch function is not executed,. Register import React, { Component } from "react"; import { Link, Navigate } from 'react-...
ghiasi's user avatar
  • 13
0 votes
1 answer
166 views

How to upload the data from the Redux to the database?

I have a project with React frontend and Laravel backend with MySql database. I am trying to learn React and Laravel by building this project. I am trying to put the products to the redux if the user ...
saddysad's user avatar
1 vote
1 answer
54 views

React double rendering Showing every object from the array 2 times in the UI on react redux-toolkit

I was building a bulletin board app using redux-toolkit. I used the jsonPlacehlder fake API for the content of the app. But after fetching data from the API, while showing it on the UI every object is ...
Bs Joy's user avatar
  • 101
4 votes
1 answer
461 views

Next13 'Cannot access 'slice' before initialization' when using createAsyncThunk

I want to fetch some user data from the backend directly into redux and for that, I used createAsyncThunk. I've created the slice and I made a getUserData function inside the slice file using ...
Oliver's user avatar
  • 382
1 vote
1 answer
67 views

Why getPosts() is called within dispatch parentheses? How dispatch is working here?

export const getPosts = () => dispatch => { dispatch(setPostLoading()); axios .get('/api/posts') .then(res => { dispatch({ type: GET_POSTS, payload: res.data ...
Ashik Ghosh's user avatar
1 vote
0 answers
37 views

Why do i need to call dispatch twice when using redux-thunk [duplicate]

here is the code while using useDisplatch hook const dispatch = useDispatch(); useEffect(() => { dispatch(fetchUsers()); }, [dispatch]); and here is fetchUsers() export const fetchUsers = (...
Precious's user avatar

1
2 3 4 5
52