Questions tagged [redux-middleware]
88 questions
0
votes
1 answer
Redux - updating store based on async api calls
I have a use case to render page using redux with graphql api calls.
On first component will call default action to fetch data from graphql, and stores in redux state as below
state = { films: {
totalCount: 6,
films: [
…

sudpap
- 3
- 2
0
votes
1 answer
react redux middleware cannot access variable defined in utils
Hi I created a redux custom middleware and trying to call apiUrl contstant value defined and exported from ./utils/api.js file. but getting this error
ReferenceError: Cannot access 'apiUrl' before initialization
.utils/api.js file
export…

Maqsood Ahmed
- 1,853
- 1
- 10
- 18
0
votes
0 answers
Error creating redux middleware to add header param to axios request
I'm trying automatically add to all axios requests an access token and I'm using (or trying to) a middleware. But I'm getting the following error: 'store' implicitly has type 'any' because it does not have a type annotation and is referenced…

juliano.net
- 7,982
- 13
- 70
- 164
0
votes
1 answer
Redux gives error "Error: Actions must be plain objects. Use custom middleware for async actions."
I'm very new to redux. I tried my best to resolve this error in redux but it still gives me an error.
The error is message is:
Error: Actions must be plain objects. Use custom middleware for async
actions.
Please help me resolve this.
The error…

rove
- 11
- 3
0
votes
2 answers
How to retrieve the value of a yield function call?
I am working on a project which began last year, and the developers are not with me. They wrote this code :
import { put, takeLatest, all, call } from 'redux-saga/effects';
import { getUserByUsernameService } from…

pheromix
- 18,213
- 29
- 88
- 158
0
votes
1 answer
Dispatching a thunk from a middleware results in an error
I have a thunk defined in my actions.js file:
export const myThunk = (param1, param2, param3) => {
return dispatch => {
dispatch({type: types.myThunkType})
…

André Carvalho
- 111
- 1
- 11
0
votes
1 answer
React / Redux custom middleware - useDispatch not updating the state
I would like to create some middleware to check a tokens expires_at field refreshing the token if necessary and updating the state for the token fields.
I have used the redux toolkit to create the redux functionality, making use of slices. I have a…

Matt
- 343
- 2
- 4
- 17
0
votes
1 answer
Why after page refresh my redux store is empty?
I'am using redux store in my reactjs project.my redux is working properly but when i refresh the browser page my redux store goes empty. is there any way to avoid this.

vijay kasar
- 145
- 1
- 12
0
votes
1 answer
When calling createStore() I get: TypeError: middleware is not a function
Before flagging this has duplicates note that I have checked:
How to dispatch a Redux action with a timeout?
TypeError: middleware is not a function
× TypeError: middleware is not a function
I am trying to integrate redux-thunk and use replace…

AsTeR
- 7,247
- 14
- 60
- 99
0
votes
0 answers
redux error on the property 'type' while using middlewares
I'm trying to integrate a logger in my redux app, using the applyMiddleware api, but when I trigger an action I got this error:
Actions may not have an undefined "type" property. Have you misspelled a constant?
This is strange because all of my…

optimusfrenk
- 1,271
- 2
- 16
- 34
0
votes
1 answer
Error, looks like Promise has disappeared when using redux-pack
I am new to using redux-pack but like the way the promise approach really cleans up the code and makes each step very clear. However I have hit a problem where the promise seems to vanish and and error gets thrown. My code looks like the…

JSDevGuy
- 127
- 2
- 11
0
votes
1 answer
How to add path to cookies using redux middlewares?
I am using redux-cookies-middleware and there I can pass just name and value for the cookies. But if I need to add path how should I pass it?
{
session: {
name: 'session' // name of the cookie in which the value of session will be synced
…

Serhii Minin
- 47
- 1
- 8
0
votes
0 answers
Share store/actions between Redux instances
Is there a way to share the redux store between multiple React/Redux instances on the same page?
The content of my webpage is provided by a CMS. I want to include several React widgets on the page, but the problem is that each instance has its own…

Steven Vervaet
- 15
- 4
0
votes
2 answers
Add react middleware when not in production
The question is simple,
How I can add a react or redux middle-ware (like Logger) when not in production.
I don't want users be able to see the logging info in the console tab.

M.R.Safari
- 1,857
- 3
- 30
- 47
0
votes
1 answer
Callbacks on axios-redux-middleware request do not fire
Can someone explain to me why callbacks defined on action creator do not fire?
The code in question can be seen here.
Is this plugin good to work with? (It seems abandoned.)
How should I handle API calls in medium application?
Thanks in advance.

Jan Ciołek
- 1,796
- 3
- 17
- 32