A
A
Adventure20682020-11-12 16:46:38
redux
Adventure2068, 2020-11-12 16:46:38

What is the correct way to call action in redux?

There are 2 actions: fetchRepos, setCurrentPage. There is also a saga for getting api data on fetchRepos. fetchRepos is called on render and after every setCurrentPage. What is the correct way to call actions in this case. Do sequential dispatch in the useEffect component or create a saga that will call fetchRepos for each action setCurrentPage?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
twolegs, 2020-11-12
@Adventure2068

How to properly call

It is hard to say. Here, as you like best, and what agreements you accept when developing. In terms of business logic isolation, it's better to put it in one saga.
But this method can also have opponents, because. it's not so obvious anymore in terms of readability.
My personal recommendation is if you use sagas then do all the side effects in it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question