How did I apply Redux to the Android application?

Tram Ho

Foreword

By chance I had the opportunity to participate in a project using React-Native and Redux architecture, I was really interested in Redux . That is also the reason I want to apply the Redux architecture to Android applications.

The library that I use in this article is called Kdux

What is redux

Redux is a predictable state management tool for JS applications. It helps you write applications that operate consistently, run in different environments (client, server, and native) and are easy to test. Detail

Redux consists of the main components:

  • Store: The state that manages the State or state of the application.
  • Actions: This is where you define the events that the application wants to communicate with the State managed in the Store through the store.dispatch() .
  • Reducers: As the processing layer, they will retrieve the current state, through the events defined in Actions , corresponding to each action, they will return a new state.

Begin

We will start making a simple counting application.

  • Initialize a State
  • Initialize an Action
  • Create a Reducer
  • CounterActivity

Result

Tada

summary

Redux is a tool that helps you manage application statuses. In addition, it helps to separate login functions, making it easy to test.

Hopefully with this article, partly helps you understand how Redux . Good luck.

References

Share the news now

Source : Viblo