All Questions
Tagged with redux-saga redux-thunk
79 questions
0
votes
2
answers
72
views
ReduxSaga makes my website re-render infinite
Im using Redux-Saga and Redux-Thunk, this is store I have configured, but it makes my website re-render infinitely. Can u tell me what should i do to solve that? Thank u.
Store.js
import { createStore,...
0
votes
0
answers
109
views
Redux saga Method is being called twice(React Native)
Redux saga method is being called twice in React native application.
Please find
saga.ts
export function* fetchValueLable(action: IFluxStandardAction<ILables>) {
try {
if (!action.payload) ...
0
votes
2
answers
337
views
How to call generator functions with React-Thunk
I'm in the process of converting some sagas to thunks. Some of these sagas have nested generator functions that I'm not able to call within thunks. Normally in a saga I do:
const result = yield call(...
-3
votes
1
answer
179
views
Refactoring from Redux-thunk to Redux-saga (+axios)
I ask for help with the Redux-saga, namely with refactoring the code below. Any ideas or explanations are welcome. The code below gets a list of hotels from the API on request with parameters from the ...
1
vote
2
answers
521
views
Clarifying advice on strategizing use of Redux-saga, Redux-thunks, Context-Hooks, and/or React-query - with React project (Next possibly)
I've been attempting to understand the relationship in using these in projects. Determining which is appropriate/advantages is making me go a little crazy and I don't want to assume that something is ...
1
vote
0
answers
662
views
Access state in one redux saga file from other redux saga file
I am using react redux saga to implement something in a calendar application. This calendar application has multiple settings/params. One of them is the currentAccountId, which is in the initalState ...
0
votes
2
answers
319
views
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.
2
votes
1
answer
1k
views
When to use Redux-saga / Redux thunk and when not not? [closed]
to be honest I know when to use Redux and the global state, but I have been seeing a lot of codebases which are using Redux-Saga or Thunk for almost all the api calls
everything is being saved on the ...
0
votes
1
answer
929
views
Equivalent of a yield take Redux Saga in Redux thunks
I'm currently converting the sagas in the code base to thunks.
I know that Sagas' specific functions such yield put, yield call have a "direct translation" to thunks dispatch(...) and await ...
0
votes
1
answer
258
views
when we use createSlice we handle sideEffect using createAsyncThunk() function ,any way to achieve this functionality in saga style?
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import axios from "axios";
const initialValue = {
value: 0,
name: "praful"
}
export const ...
1
vote
1
answer
897
views
Why we need to call api in redux thunk or saga why not in component?
when we need to some data through api and we use redux in react that time we use redux-thunk or saga but my qustion is it also possible through component useEffect hooks, we call api in useEffect and ...
1
vote
0
answers
90
views
How to include React-Admin In Another Redux Application
I'm trying to embed react-admin into another redux application. The docs outline how to do this here. However, the main app located here uses configureStore rather than createStore. Moreover, ...
0
votes
2
answers
576
views
redux-thunk: how to trigger on action?
I come from a background of working with react-saga, which has the concept of "effects" which lets us trigger action handlers in response to Redux actions being dispatched:
take('MY_ACTION', ...
-2
votes
1
answer
289
views
(JS libraries) redux-thunk vs redux-saga [closed]
I am currently learning both libraries. What are the criteria for choosing which one ist best for my type of application? Redux-thunk has three times more weekly Npm downloads right now. Is there any ...
0
votes
1
answer
66
views
Redux TypeError: Cannot read property 'list' of undefined
I have created a simple website where you can track currencies and add them to your favourite list. I use http://api.nbp.pl/ for that. I was told to use redux for state management. the idea is that ...
2
votes
2
answers
146
views
Different ways to fetch values from web services in react redux?
Trying to find the best way to fetch values from web services in ReactJs, redux.
Found ways using useEffects, fetch, redux-thunk, redux-saga.
But which is best to be used..?
2
votes
1
answer
3k
views
What should I use redux-saga or redux-thunk in 2021?
Which one should I use? For more context I use redux-toolkit. Advices to help understand which tool fits better are appreciated
0
votes
0
answers
150
views
Unable to fetch the data from firebase child using React Redux-Saga?
I am unable to fetch firebase child data with React and Redux-Saga. Can you please check the below code ? Why it is not working with redux-saga.
import { takeLatest, put, call, fork, all, take } from &...
1
vote
2
answers
684
views
Typescript error when dispatching action created by createAsyncThunk from saga
Example:
/* actions.ts */
export const getTeacherChats = createAsyncThunk(
'messenger/chats',
async (params, thunkAPI) => {
const response = await messenger.getTeacherChats()
if (...
2
votes
3
answers
8k
views
How to queue requests using react/redux?
I have to pretty weird case to handle.
We have to few boxes, We can call some action on every box. When We click the button inside the box, we call some endpoint on the server (using axios). Response ...
0
votes
2
answers
464
views
Reducer not getting called even after action is dispatched
My use case is that I want to clear some data from my state. For clearing the state, I don't need any api calls hence, I have not written any saga for it.
Action.js
export const remove = (payload: ...
4
votes
1
answer
3k
views
createAsyncThunk: dispatch more actions after updating store with fetched data, within a same payload creator
I just started using Redux Toolkit(RTK), and I'm having a hard time figuring out a proper way of using createAsyncThunk from RTK.
So what I'm trying to do is to
dispatch an asynchronous action ...
1
vote
4
answers
163
views
Should we be using redux in the following case?
I'm working on an enterprise application which is huge on forms, there are pages and pages full of forms. Normally when it's just form, we could simply use a library like formik or react-hook-forms, ...
0
votes
1
answer
82
views
Using Redux-Saga in New Redux template react app
The new redux has a template built in for store and all the necessary thing to start a react redux app but it is using redux-thunk under the hood to make async calls. It it not possible to replace ...
1
vote
1
answer
2k
views
after using swr doesn't even mean use redux-thunk or saga?
I am going to develop a panel with tables and many other components with reacted as spa and redux and other related stuff, I am going to use Swr(a cool package) for fetching remote data and cache it.
...
2
votes
2
answers
2k
views
Should I make all API calls with redux, or should I keep them simply in components? [closed]
I am new at using react/redux. I just started working on a react project, but I don't really know which one do I choose when when it comes to making API calls. Should I do all of API calls with redux ...
0
votes
2
answers
845
views
React Navigation v5: How to navigate using redux thunk/redux saga?
How can I navigate the screen in react-navigation in Redux-Saga and Redux-Thunk? Is it possible to get access to the navigation context in sagas or thunk?
For example in redux-thunk
import { ...
2
votes
2
answers
1k
views
How to chain redux actions using returned result of the previous action?
I'm building an app in React Native, and using Redux with redux-persist to act as on device database.
The crux of the issue is, how do I return the result of a redux action, to then dispatch another ...
1
vote
0
answers
320
views
How to use thunk instead of Redux Saga in Metronic
I'm using Metronic theme to build a React application. v7
By default metronic uses redux Saga. I'm not familiar with Saga. I know thunk. So I tried to modify the code but I'm stuck at the splash ...
-1
votes
1
answer
24
views
Redux with redux saga/redux thunk. Why some people says I shouldnt use thunk now because theres a saga
Im learning redux middleware, saga and thunknspecifically and I'm kinda confuse on why theres two exisiting middleware if they doing the same and benefiting your app. And I read some in the blog/post ...
0
votes
1
answer
162
views
execute custom callbacks immediately after redux store update
How do I execute custom callback that is passed into an action through react comp, immediately after redux store update.
The idea is say, I trigger an action from react, which will make network ...
0
votes
0
answers
56
views
In React / Redux, how is race condition Ajax responses handled?
Does any existing react/redux related package handle Ajax race-conditions?
If the user clicks on "Blue" or "Peter", and the screen is supposed to update info for the product to blue or show messages ...
0
votes
1
answer
853
views
Do I need middleware like redux-thunk or saga? Angular-redux
Hi I'm developing an Angular website. I used Angular build-in httpClient library to make backend call. It return an observable. So I subscribed that observable and dispatch straight from that ...
0
votes
2
answers
334
views
Dispatch not changing object in Redux state
So I'm building an ecommerce app, and I have two values stored in the redux state to handle the cart. One is an array of objects, each of which contains two keys for objectID and quantity. The other ...
1
vote
1
answer
853
views
What is the alternative to thunk dispatch in saga?
In my react project, I have the following code.
import uuid from 'uuid';
import { SET_ALERT, REMOVE_ALERT } from './types';
export const setAlert = (msg, alertType, timeout = 5000) => dispatch =&...
0
votes
2
answers
486
views
How to convert the thunk action to saga
I'm very new to redux-saga and am trying to get a simple demo working that makes an API call and performs pagination. It is my understanding that the redux-saga flow should work as follows.
The Page-...
0
votes
1
answer
63
views
Is it safe to edit same piece of state with two dispatches in a row
I'm using redux-thunk. I need to make a state empty and then fill it with data. For some reason, I have two separate actions for that, emptyName, addName.
So what I was doing was just to dispatch ...
0
votes
1
answer
879
views
A way to handle async state updates on Redux store without using redux-thunk or redux-saga middleware?
I'm all in favor of NOT solving problems you don't have.
So I started learning and using React without Redux.
But now my app state has grown and I'm starting to face some state management issues.
...
2
votes
1
answer
861
views
why to use redux saga or thunk at all
I am really confused by redux saga. So whatever article I look at they explain that it is there to fix the side effect of redux and asynchronous calls and even they give explanation on the difference ...
1
vote
0
answers
83
views
Wait for a specific property of the redux store to update from outside a React component
Normally what I will do inside a React component is to use the connect function to subscribe to the redux store, in that case I have access to the redux store and im aware when it's updating.
I want ...
0
votes
0
answers
80
views
Using geolocation with react native & redux-thunk
currently, I'm working on a project using MapView,
so I'm struggling to use geolocation.getcurrentposition with react native and redux-thunk, so if there's anyone who can help me I will be very ...
0
votes
2
answers
2k
views
A pattern to manage intial async actions with redux sagas for fetching initial data?
Until now I've been using redux-thunk for async actions. On application startup I use to have to load some data from some server. So what I do is to create async actions and then use async/await in ...
2
votes
0
answers
297
views
With react-redux how do you implement immediate UI prior to asych update call to backend, then rollback if the update is unsuccessful?
With react-redux how do you implement immediate UI prior to asych update call to backend, then rollback if the update is unsuccessful? (currently using redux-thunk, but could look to another ...
0
votes
1
answer
371
views
How to "use multiple redux-middleware" with reactjs app?
I'm using redux-thunk and redux-saga as middleware and my action call is successful but when I reload the page data is lost, the lifecycle method is called but it doesn't make a call to the server ??
...
13
votes
3
answers
9k
views
When should I use Redux Saga instead of Redux Thunk, and when should I use Redux Thunk instead of Redux Saga?
The question is different from the past which is why. The question for this one is When. Since both are good frameworks by themselves the question is when should I use thunk than saga. Because one of ...
0
votes
1
answer
3k
views
How to handle erros with redux saga
I try to error handling with redux saga. Far now its always returning 404 error when i changed the api url. I organized my reducer and redux saga. but ı can't reach to fetching item
This is my Reducer
...
6
votes
3
answers
8k
views
Error in <Provider> - Check the render method of `Provider`. react-redux
enter image description here
Code: this is my index.js file
index.js
import { Provider } from "react-redux";
import { createStore } from 'redux';
import App from './app';
import ...
2
votes
0
answers
410
views
What is the best place to put pure and synchronous logic while using React with Redux and Redux-Saga?
After previously using Redux-Thunk, I've been playing around with Redux-Saga lately. So far I am loving it for handling asynchronous tasks like network requests. So in using sagas, I will definitely ...
0
votes
0
answers
48
views
getting error "Actions must be plain objects. Use custom middleware for async actions."
I am trying to dispatch some actions with redux saga but getting error
function fetchCreationsRequest (requestPayload) {
debugger
return {
type: FETCH_CREATIONS_LOADING,
...
0
votes
2
answers
1k
views
redux-thunk and redux-saga simultaneously
I've come across two sources where it explains how to use two middleware systems together.
The first one says:
You can add the saga middleware right alongside the thunk middleware. Remember, the ...