, 17 tweets, 5 min read
I felt super nostalgic the last week and wrote an homage about why every JavaScript developer should learn Redux 😅

robinwieruch.de/redux-javascri…
Even though you will not use Redux on a daily basis, there are just too many hidden gems in learning it; which will benefit every #JavaScript developer.



Here it comes 👇🍿
⏯️ Redux in a nutshell in context of a UI library like React 👇
The Redux Store just offers a slim API to write/read state and to listen to state updates. That's all what the library gives you to the outside.
All the other parts of Redux are just plain JavaScript.

🧙‍♂️❌ No hidden magic.
✅ Just making you a better JS dev.

Note: Check previous tweet to put myReducer and myAction into context.
Until now, there was no word about #ReactJs.

Redux is just a state container; which is just a complex word for

✅ a JavaScript object holding information
✅ a slim API to read/write/listen to state



React is just a use case for Redux.
Since all data is treated as immutable in Redux, JS developers learn a great deal about immutable data structures.

✅ Their benefits.
✅ How to use them.
Learning on the side:

One is not only learning about array.push mutating an array instead of creating a new one, it also returns just the array’s new size instead of the mutated array. 😅
In Redux every reducer, but also action creator and selector, should be a pure function.

❌ No side-effects.
✅ Keep your functions pure.



Just another great benefit (e.g. for testability and predictability) for every JS developer to learn about.
Even though some additions are syntax sugar on top — like action creators — they follow the clear constraint of being pure functions.

✅ All parts in Redux have a clear purpose and API.
JavaScript ES6 got released the same time when Redux got traction. Lots of language additions supported Redux’s constraints for immutability and pure functions.

✅ Developers started to think more in functions.
The unidirectional data flow in Redux made it predictable for state management.
Combined reducers invited developers to think about all the specific domains in their application.
Redux’s event-driven architecture moves the attention from

✅ explicit to implicit state changes
✅ setters to events
✅ one-purpose to multi-purpose reducers
✅ narrow minded to open minded reducers
☝️ Keeping in mind that the last two examples are not perfect here, because any sorts of statistics computed based on the todo entities could be calculated on the fly by having all todos available from the state and calculating their stats with the right selector just in time.
Some of the key benefits of learning Redux:

✅ exploring slim API design of a library
✅ clear constraints of every piece
✅ immutability & pure functions
✅ domain-driven
✅ thinking in functions
✅ thinking in events, not setters
✅ unidirectional flow of information
✅ KISS
So yeah, I'd argue it doesn't do any harm to learn Redux 😅 I hope you enjoyed this learning series 🙂✌️



robinwieruch.de/redux-javascri…
Missing some Tweet in this thread? You can try to force a refresh.

Enjoying this thread?

Keep Current with Robin Wieruch

Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!