Questions tagged [redux-actions]
101 questions
2
votes
3 answers
Best practice for naming redux action type description
Currently when using action type named as
MY_ACTION_TYPE_1 = 'MY_ACTION_TYPE_1' when it gets really long, it becomes utterly unreadable as it got cut off from the view in the redux chrome extension. what is the best practice to name the value?…

ey dee ey em
- 7,991
- 14
- 65
- 121
2
votes
2 answers
_This2 not a function error when dispatching action
Background
I am working on a very routine chunk of code, I have created actions and reducers many times throughout my app. I am now setting up authentication, and have two containers loading based on routes / & /register.
Issue
I am trying to…

Bromox
- 567
- 2
- 9
- 29
2
votes
1 answer
Update array of objects immutably and manage length redux
I am trying to save the search history in a react / redux app (using redux-actions) I am making in the reducer. I want to save the latest ten searches and have the latest at the beginning. I have an array of objects and I want to (immutably) add a…

cbutler
- 1,111
- 5
- 16
- 32
2
votes
1 answer
How to fetch data from firestore with immutable.js and redux-actions in react native?
I'm a beginner of react native. If you give me any advice, it would be helpful and I would appreciate you.
I'm trying to fetch data from firestore using react-native, immutable.js, react-redux, redux-actions also this codes follow ducks…

Mingyu Jeon
- 1,755
- 5
- 23
- 40
2
votes
2 answers
redux-actions createAction default parameters in payloadCreator function (typeScript)
if i generate an action as such:
export const updateParticularObjectValue = createAction(
UPDATE_PARTICULAR_VALUE,
(id: string, amount: number, reason: string = 'default') => {
return { id, value: amount, reason };
},
);
for…

derelict
- 2,044
- 10
- 15
2
votes
1 answer
Unusual syntax to create object method from a single item string array
I come cross this redux-actions tutorial, and I noticed a unusual syntax to create an object method:
const stringArray = ["STRING_ARRAY"];
const strangeObject = {
[stringArray]() {
console.log(stringArray);
}
};
Can someone name or explain…

Salah Eddine Taouririt
- 24,925
- 20
- 60
- 96
2
votes
2 answers
How do I allow for multiple statements in my reducer?
I am forced to use the redux-actions. In my reducer this code works:
return handleActions({
[FOOBAR]: (state) => ({
...state, value: 'the user clicked something 2'
})
}, {})
However, in the reducer I would like to console.log some stuff.…

danday74
- 52,471
- 49
- 232
- 283
1
vote
2 answers
redux-actions library to refactor a counter example in Typescript errors
I am new to Typescript and wanted to practice a library called redux-actions. I followed this tutorial:
https://youtube.com/watch?v=8DH7Ekp2PWI&feature=shares
and I tried to use the redux-actions…

Altaf
- 399
- 1
- 5
- 15
1
vote
1 answer
Why actions in createSlice RTK doesn't work?
I'm creating the todo-app with Redux Toolkit. In this app I have three slice-components which has almost the same logic. All initial states of these components are reachable, but not the actions and reducers. And states in Redux DevTools are…

alienaline
- 13
- 2
1
vote
2 answers
How to display username on navbar after login in react redux
There is a nav link on my navbar named Login (I have used bootstrap navbar). After successful login I want to replace Login with a username using react-redux (not redux-toolkit).
Kindly help me in writing reducer and action code. As I am a beginner…

anonymous
- 75
- 3
- 6
1
vote
1 answer
React redux - pushed object in the state is not mapped but initialState is
I am working on some app where you can save a note about a video. I have some redux issues, sorry that I am not specific but I don't know where the problem is. Every time when I am using 'ADD_ITEM' action, everything works fine in the devtools I can…

twolsh
- 11
- 1
1
vote
1 answer
(React Redux) The whole state restarts and deletes all changes made when I add a new item
The reducer goes like this:
import {
CREATE_COUNTRY,
} from "../actions/actionConsts"
export const storeInitialState = {
countries: [],
otherThings: 0
}
export default function countriesReducer(prevState = storeInitialState, action)…

Rafael
- 2,413
- 4
- 32
- 54
1
vote
1 answer
Reducer Custom Dispatch Type, is not assignable, Types of property ‘dispatch’ are incompatible
I have a simple reducer & action types right now. While setting up my tests, I am running into a type def issue with the return of my store in reference to my "custom" action type declarations. I am seeing an error:
Type ‘Store

Phil Lucks
- 2,704
- 6
- 31
- 57
1
vote
1 answer
Redux action dispatch
In my redux action, I have one action will be called by another two actions, code is below:
export const addParticipantFromPopupRequest = (participant, project_id, currentStep) => async (dispatch) => {
const result = await…

Moon
- 128
- 3
- 14
1
vote
1 answer
What is the purpose of brackets, [], in handleActions()?
I came across a vanilla counter tutorial:
const reducer = handleActions(
{
[increment]: state => ({ ...state, counter: state.counter + 1 }),
[decrement]: state => ({ ...state, counter: state.counter - 1 })
},
defaultState
);
I haven't…

Joseph D.
- 11,804
- 3
- 34
- 67