What Is Redux? - How does it Work?

What Is Redux? - How does it Work?

What Is Redux?

No alt text provided for this image

Redux is simply a store to store the state of the variables in your app. Redux creates a process and procedures to interact with the store so that components will not just update or read the store randomly. Similar to the bank. It does not mean because you have money in the bank that you can go anytime, open the vault, and take money. You have to go through certain steps to withdraw money.

Principles of Redux

Single Source of Truth?

The state of your whole application is stored in an object tree within a single store.

  • A single state tree makes it easier to debug or inspect an application
  • It gives you a faster development cycle by enabling you to persist in your app's navigation state

State Is Read-Only

  • This feature ensures that no events like network callbacks or views can change the state. They can only express an intent to change the state
  • Actions are just plain objects; they can be logged, serialized, stored, and later replayed for debugging or testing purposes

Changes are Made with Pure Functions

  • The user can return new state objects instead of mutating the previous state
  • The user can start with a single reducer, and, as the app grows, can split it off into smaller reducers that manage specific parts of the state tree
  • Because reducers are just functions, it’s easy to control the order in which they are called, pass additional data, or even make reusable reducers?

要查看或添加评论,请登录

Morshedul Islam Munna的更多文章

  • Rust Program ? ??? ?????? Allocation ????

    Rust Program ? ??? ?????? Allocation ????

    ???? ?? ??? ????? ??? ??? ? ---- Rust-? ?????? Stack, Heap ??? Static Memory ?? allocate ??? ???? ??? ? ???? ???…

    1 条评论
  • React + Axios - HTTP POST Request Examples

    React + Axios - HTTP POST Request Examples

    Installing Axios from npm With the npm CLI: npm install axios With the yarn CLI: yarn add axios Simple POST request…

  • Complete Guide & Learning Resource

    Complete Guide & Learning Resource

    ????????? ??? ???????? ??? ????????? ?????????? ??????? ??? ???? ???? ????? ???? ??? ??? ???? ??? ???? ?????? ??????…

社区洞察

其他会员也浏览了