![]() Here is where the application state lives. You might have also noticed that we don’t have any sagas or reducers, before we create them let’s learn about the Store. Notice that after initializing our Middleware we create the Redux store with it and we also specify the Reducers we are going to be using as well as triggering our sagas. For now it is enough to know that it helps the Redux-Sagas library communicate with Redux. We will not go deeper in explaining the Middleware, for further information follow this link. "A third-party extension point between dispatching an action, and the moment it reaches the reducer" The function createSagaMiddleware() does exactly this for us, it creates the Saga middleware for the Redux-Sagas library. redux-saga is a redux middleware, which means this thread can be started, paused and cancelled from the main application with normal redux actions, it has access to the full redux application state and it can dispatch redux actions as well" "The mental model is that a saga is like a separate thread in your application that's solely responsible for side effects. ![]() What is a Saga? According to the documentation: Well, it's a library that helps us make application side effects easier to manage, more efficient to execute and handle failure states, such as asynchronous code like client APIs. Now that we have established what Redux is and what it does for us, why Redux-Sagas? We will learn about them throughout this Lab, so don’t worry just now. In order to accomplish this Redux introduces 3 key concepts: Actions, Reducers and the Store. We can now accomplish Single Responsibility, a Component does not need to worry about propagating state updates, Redux takes care of that for us. This concept helps us decouple the business logic of our app and removes dependency. This is great, we can now share state between different components of our app without ‘ lifting state up’. "A pattern and library for managing and updating application state, using events called "actions" it serves as a centralized store for state that needs to be used across your entire application, with rules ensuring that the state can only be updated in a predictable fashion" First of, what is Redux ? The documentation describes Redux as: There is a lot going on here so let's dig in.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |