Hi, guys! :)
You can call me Tari, I’m one the member of the very awesome team allocateam.
Before we get into, why redux, why not the other thing, let me tell you first about what it is actually. If React is the framework for our javascript, then what the use of Redux? As the title said, Redux will handle the complex state of an object.
With the UI of website getting improved all the time (adding some component and more complex things), we also asked to keep the state of the object are on track as best as possible. Yet, at some point, the state tend to become questionable as we asked ourself, “How the list have this kind of state?”
This is where Redux come!
Redux will put all the state in a store AND we will only have on a tree in our apps that store all of our states. Maybe you think it’s kinda cool, but it’s going to be big and hard to read; stay calm guys. We will get into that because definitely, Redux have something to handle it (psst, it’s call reducer ;))
Imagine that you write your app’s state as a plain object, this object is like a model but it has no “setter”, so the only way to change part of it is to dispatch an action. Using this concept, we know how and why if something has changed. Next, we’ll need the reducer to tie the action and state object—as a reducer will be hard to maintain for a big app, then we can write smaller function managing part of the state and have another reducer that organizes all the states in our app.
Last, if you want to know more about Redux you can check in its official website, here it is—and this one writing with a cartoon which I think explain the flow a lil bit better.
0 komentar:
Post a Comment