All Questions
134 questions
1
vote
2
answers
230
views
Async/Await Not Working with Redux Dispatch Function in React
In this code snippet I want to know why async and await not working.
This code in my component I am sure that is no errors:
const { success, loading, error } = useSelector(
(state) => state....
0
votes
1
answer
63
views
Wait until all subpromises are resolved [closed]
Let's say I have something like:
const exampleFunction = () => {
const fetchActions = someArray.map(() => {
dispatch(action()).then(response => {
if (...
0
votes
1
answer
558
views
Multiple components decide to fetch an object at the same time
I have a React component that somehow looks like this:
function MyComponent(props) {
const dispatch = useDispatch(); // Redux dispatch function
const isLoading = useSelector(selIsLoading); // ...
0
votes
1
answer
153
views
How to assign array within Redux AddCase fulfilled case
I am having a problem trying to figure out how assign an array of users after an async fetch. I have a simple interface User, which has an id and a name:
export interface User {
id: number
}
...
1
vote
1
answer
330
views
Redux-Thunk Error: Actions must be plain objects. Use custom middleware for async actions
I have a songbook app with firebase as a backend and struggling with an
Error: Actions must be plain objects. Use custom middleware for async actions.
Action creator
export const createAction = (type, ...
0
votes
1
answer
25
views
How to add a promise in the redux and execute according to Data
I have a function that i am calling on a button click
const onButtonPress = () >{
storeDataInDB()
}
const storeDataInDB= () =>{
// Call multiple functions inside here and take a 1 minute to ...
2
votes
0
answers
85
views
Receiving 'jwt malformed' message when trying to load my website initially with Redux
Upon login I have my initial component that calls a Redux action but after logging in the user token isn't sent fast enough to be received by the axios header, if I console.log(token) before and after ...
0
votes
2
answers
731
views
How do I make two dispatches in redux run in order?
Suppose I have two dispatches I want to fire in order called
dispatch(action1())
dispatch(action2())
Action1 is an action creator created using
createAsyncThunk
method from redux/toolkit.
Therefore,...
0
votes
1
answer
2k
views
Await for items from Zustand (redux) store to be loaded before rendering page
I have a react native component that loads information from a zustand store (similar to redux store)
const members = useMemberList((store) => store.members);
I want to access specific data from ...
0
votes
1
answer
258
views
Uncomplete payload | React & Redux Toolkit
I have a big problem,maybe it's not so big but i dont sleep for almost 24h because of it.I barely finished this Slice,but now,when i submit the data,i get only the automatically set id..
So,to be ...
0
votes
1
answer
1k
views
how to use redux useSelector to check state and do a fetch to a database
I am using redux in a project and I want to make a useSelector that would check to see if the values in the redux state are the default values if not it will do a request to the database and update ...
1
vote
2
answers
990
views
How can I synchronize data from two different queries, where one is being transformed in useEffect?
I have an array and map being fetched from two different RTK Queries. Array A contains metaData (Id's) used to access the values in map B. Hence, their recency needs to be synchronized so that every ...
0
votes
1
answer
94
views
React-Redux connected component failing to update view/trigger rerender when setState is called
Im using a redux connected component in react. Just having trouble rendering a button after the handleSubmit onClick handler is called. It only appears after I refresh the page, which may indicate an ...
0
votes
1
answer
218
views
Question about Redux async operations with Thunk
I just recently got introduced to Redux and decided to learn how to implement it. At the moment I'm refactoring some of my previous studying-projects and implementing the global state logic provided ...
0
votes
2
answers
55
views
How to make other function gets called after first is executed?
I am working on a react app where I am using redux for state management and I have 2 functions to call and I want them to run only after 1st function is executed.
Here's a snippet of whats I am doing:
...