Live data from Hacker News

How Redux Works: A Counter-Example

daveceddia.com

11–20 of 84 posts

Re: How Redux Works: A Counter-Example

#11
post #3
post #2

It is interesting how people have the idea that react === Redux/flux. Where in fact Redux is unopinionated and works with other libraries/frameworks just fine.

How often do you see redux used with anything other than react? Or are you just talking about redux working with react alternatives like preact/inferno, etc? You're not wrong, but practically 99% of people pair it with react.

The Redux pattern is used quite widely, even if not via the official library. See NGRX for example, which implements the pattern in TypeScript + Angular.

https://github.com/ngrx/platform

Re: How Redux Works: A Counter-Example

#12
post #7
post #4

There is a certain paradox with teaching something like Redux, in that it's designed to make complex systems easy to understand and manageable. Yet when trying to demonstrate with a simple example, it appears hugely over complex and unnecessary. I think a pre-requisite to learning something like Redux (or any micro-architecture) is to first try building something without it. Once you understand the pains of undiscipl…

This paradox I think is what turns people off Redux when they first learn it. "All this code... for what benefit?" Of course it's total overkill for something like a counter, or a todo list, but it's tough to teach an introduction to something by starting with "here's a huge enterprise app, let's dive in" :) I tried to call this out in the article to make sure people are aware that improving simple Counter examples i…

> "here's a huge enterprise app, let's dive in"

I'd love to see a complete project that uses redux, and would be horrible without it. Any pointers?? :)

Re: How Redux Works: A Counter-Example

#13
post #4

There is a certain paradox with teaching something like Redux, in that it's designed to make complex systems easy to understand and manageable. Yet when trying to demonstrate with a simple example, it appears hugely over complex and unnecessary. I think a pre-requisite to learning something like Redux (or any micro-architecture) is to first try building something without it. Once you understand the pains of undiscipl…

I think there's a fair criticism of Redux in here - most well designed tools can accomodate a learning curve, and scale up the complexity when needed. I can be productive in Express without knowing about middleware, or git without knowing how to rebase.

Redux, on the other hand, expects you to dive into the deep end head first the first time you use it. I teach javascript development, and I'm noticing there's a pretty big gap where you're feeling the pain of React, but Redux is still too large a complexity tax (To be fair, even to an experienced programmer it often is - for every complex state change that warrants Redux there's 50 straightforward "change this field" or "toggle this boolean" actions.)

Maybe this isn't the responsibility of Redux, and something should be built on top of it, but there needs to be some amount of consensus on what the best solution is.

Re: How Redux Works: A Counter-Example

#14
post #7

Earlier quoted context omitted.

This paradox I think is what turns people off Redux when they first learn it. "All this code... for what benefit?" Of course it's total overkill for something like a counter, or a todo list, but it's tough to teach an introduction to something by starting with "here's a huge enterprise app, let's dive in" :) I tried to call this out in the article to make sure people are aware that improving simple Counter examples i…

> "here's a huge enterprise app, let's dive in" I'd love to see a complete project that uses redux, and would be horrible without it. Any pointers?? :)

Here's a tool you most likely used at some point :)

https://github.com/devtools-html/debugger.html

Re: How Redux Works: A Counter-Example

#15
post #4

There is a certain paradox with teaching something like Redux, in that it's designed to make complex systems easy to understand and manageable. Yet when trying to demonstrate with a simple example, it appears hugely over complex and unnecessary. I think a pre-requisite to learning something like Redux (or any micro-architecture) is to first try building something without it. Once you understand the pains of undiscipl…

I think there's a fair criticism of Redux in here - most well designed tools can accomodate a learning curve, and scale up the complexity when needed. I can be productive in Express without knowing about middleware, or git without knowing how to rebase. Redux, on the other hand, expects you to dive into the deep end head first the first time you use it. I teach javascript development, and I'm noticing there's a prett…

Have you ever tried MobX? I haven’t tried it, but have heard it is kind of in that mid point between react state and redux

Re: How Redux Works: A Counter-Example

#16
post #4

There is a certain paradox with teaching something like Redux, in that it's designed to make complex systems easy to understand and manageable. Yet when trying to demonstrate with a simple example, it appears hugely over complex and unnecessary. I think a pre-requisite to learning something like Redux (or any micro-architecture) is to first try building something without it. Once you understand the pains of undiscipl…

I think there's a fair criticism of Redux in here - most well designed tools can accomodate a learning curve, and scale up the complexity when needed. I can be productive in Express without knowing about middleware, or git without knowing how to rebase. Redux, on the other hand, expects you to dive into the deep end head first the first time you use it. I teach javascript development, and I'm noticing there's a prett…

I perhaps foolishly go ahead and teach React and Redux to my students. The first thing I show them, however, is this article by Dan Abramov, who you perhaps know from his conference videos or his amazing work fielding React bug reports.

You might not need Redux:

https://medium.com/@dan_abramov/you-might-not-need-redux-be4...

The little example he provides is remarkably powerful and a great intro to thinking like a Redux programmer.

Re: How Redux Works: A Counter-Example

#17
I appreciate the author's work to explain this, and I like starting without Redux as a demonstration - definitely a good idea to figure out what React does on its own first.

That said, I found the reverse approach to Redux to be more confusing than the actual Redux documentation and the tutorials that Dan Abramov has already put together around Redux which explains things quite lucidly.

Example: https://egghead.io/lessons/react-redux-the-single-immutable-...

Re: How Redux Works: A Counter-Example

#18
post #4

There is a certain paradox with teaching something like Redux, in that it's designed to make complex systems easy to understand and manageable. Yet when trying to demonstrate with a simple example, it appears hugely over complex and unnecessary. I think a pre-requisite to learning something like Redux (or any micro-architecture) is to first try building something without it. Once you understand the pains of undiscipl…

My only experience of using Redux was in a completely inappropriate application and I really came to hate it, but I can see how it'd be cool if you wanted to do like... a word processor or something where you wanted an undo/redo chain.

Re: How Redux Works: A Counter-Example

#19
post #7

Earlier quoted context omitted.

This paradox I think is what turns people off Redux when they first learn it. "All this code... for what benefit?" Of course it's total overkill for something like a counter, or a todo list, but it's tough to teach an introduction to something by starting with "here's a huge enterprise app, let's dive in" :) I tried to call this out in the article to make sure people are aware that improving simple Counter examples i…

> "here's a huge enterprise app, let's dive in" I'd love to see a complete project that uses redux, and would be horrible without it. Any pointers?? :)

https://github.com/cvdlab/react-planner

Re: How Redux Works: A Counter-Example

#20
Switched our entire native app stack to a redux backend (Swift and Kotlin), never been happier. Sure there is more code in the end, but the decoupling and simplicity to use is just too good. Especially on iOS when you know how complex it is to maintain a controller hierarchy with a (now dead) dependency chain.
Post reply on HN