#5 Weekly Sharing : Intro to Redux
Every state that you ever been is that define who you are today
Redux is simplified the implementation of Flux, unlike Flux that allow us to create many store object, Redux using single source of truth for UI state, but most awesome of Redux is implementation of immutability concept. Immutability is a concept in functional programming, concept that honor every state of the object after they mutated or changed. In a broad language we can explain this concept like You were hungry and then you order the pizza, after the pizza delivery came and you ate 3 slice of pizza now you fell satiated, even now you full its not change the fact that you were hungry some minutes ago.
With Flux and immutability concept combined in Redux, every state changing in application is predictable, after an application got some state change and if you want to going back to cancel some state change you will get the predicted state and also with predictable state its make easier for us to create the testing unit. Redux has an awesome devtool (you can check itu here), this tool allow us to inspect state change in the Redux application you can time traveling going back and forward changing some element, disabled or insert some state change to create another predicted reality.
Cool, right? So lets begin to explore under the hood of Redux, the core concept of Redux consist of 3 element:
- Action and action creators
Animation above show us the concept of Redux application, to understand that animation its better to know the every part of Redux core.
In the source code reducers is switch statement on incoming action.type and reducers must return new copies of state that reflect changes.
Other than 3 element above an Redux application may also contain Middleware, middleware works like filter that can prevent an actions from reaching the reducers.
And thats all guys about our little introduction with Redux, you may getting started your first Redux application go ahead at http://redux.js.org/. Thank you for reading.
Ditulis oleh : Timen (Front End Developer of MailTarget)
Disunting oleh : MailTarget Team
*) Weekly sharing adalah sebuah kegiatan berdiskusi yang dilakukan oleh tim MailTarget. Para anggota tim MailTarget setiap minggunya secara bergiliran menjadi pemateri dari sesi berdiskusi tersebut.