

Thus, Redux Saga allows you to write a complex sequence of synchronous and asynchronous events in a clear and declarative style without callbacks. Let’s review an example of a simple saga which sends a network request. So how can the saga be put into practice?

Redux Saga is an alternative approach to the organization of side effects. In this situation, Redux Saga comes to the rescue.
#REDUX SAGA CODE#
Unfortunately, for more than a few functions the code becomes harder to read, which makes it even more difficult to test. But it all is fair as far as the logic of your action creators (or thunks) is simple.

Action Channels: Action channel is a buffer, it stockpiles actions which sagas can. Channels: Channels are of 3 types which are used to perform 3 different things, here I will brief you about those channels here but will explain in detail a bit later. In principle, it gives a good result: it’s easy to read and test the code (but you still need to mock network requests). We’ll be going through this blog that channels are played really a major role in redux-saga. The majority of projects use Redux Thunk to organize side effects. Most people will ask, what are thunks and sagas? And how can they help? Two of the most common ways of dealing with side effects in Redux apps today are thunks and sagas. As in the context of this article, only network requests are seen as side effects. There is no place for side effects in the Redux scheme of work. It is a convenient and easy method of structuring data in an application and displaying it on the client. Redux became the de facto standard as a data management technology for ReactJS applications. Well, I’ll try to explain shortly what it is and why it is so interesting to us.Ī pleasant surprise awaits those who read until the end of the article! Interested? Let’s go then! And some people don’t even know what it is about. We often use the Redux technology in our work.
