Well the NPM report showed us the trends. Every major fad peaks around 5 years in the making in JS land and then it fades away. We are halfway through. We just have to sit through the next 3-5 years.
Well the NPM report showed us the trends. Every major fad peaks around 5 years in the making in JS land and then it fades away. We are halfway through. We just have to sit through the next 3-5 years.
Actually the complexity of understanding redux actions and their effects doesn't seem to change much at all from small to very large apps. This may come down to a well designed state tree (data model), or designing simple actions that don't try to do too much. There are actually big parallels with API design. It might even be the same problem.
So does a badly designed REST API mean REST as a concept is the cause? Of course not. In most cases, REST isn't even a limiting factor. It's just been badly designed and badly implemented. I think it's the same with blaming redux for a poorly designed, poorly implemented web app.
Redux has some nice features but at this point I recommend people avoid it until they start to suffer from some of the problems it was designed to solve. You can get pretty far with a lot less complexity by use using local component state in vanilla React.
That's perhaps the biggest actual inherent problem with redux, that it may implicitly encourage everything to be in the one single centralised store, for newcomers. That's a hard problem to solve, though I'm fairly certain Dan Abramov and the other maintainers have tried to make it clear that this, and using redux at all in simple apps, is usually a mistake.
The Redux FAQ specifically has an entry with rules of thumb to help decide when it makes sense to keep a given piece of state in Redux [0].
I do agree that the "Single Source of Truth" principle [1] is probably over-interpreted, and maybe needs some caveats somehow. That said, it's tough to simultaneously say "here's the basics of how Redux works", "here's the ideas behind why you _should_ use Redux", and also try to tell people when to _not_ use Redux.
We're currently planning a revamp of the Redux docs content [2]. I'd appreciate it if you could fill out this survey on how we can improve the docs structure [3], or leave a comment in that issue thread with some suggestions.
[0] https://redux.js.org/faq/organizing-state#do-i-have-to-put-a...
[1] https://redux.js.org/introduction/three-principles
[2] https://github.com/reduxjs/redux/issues/2590
[3] https://docs.google.com/forms/d/e/1FAIpQLSfzIkY3fXZ8PrQKScYM...
You really can't see how fundamentally broken is your argument? Really???
And you are not the only one who makes this HUGE fallacy.
All the redux/react fanboys are like you. At this point I already consider those people who make these arguments that they are just following/using redux because it's a religion for them.
Not to mention the fact that some people considers the whole uni-directional message flow a HUGE antipattern. See: https://youtu.be/QM1iUe6IofM?t=1306
Could you help me see how it would result in "huge clusterfucks" with an example?
Note React doesn't rely on particular call order. You can move your calls around any way you like. Just that it's persistent between re-renders.
That does better highlight that you are worried about conditionals. (It doesn't address the loop issuie though.) Hmm, here is another one. "Static call order"?
I guess what I'm saying and what I'm reading from the parent comment is that they are misunderstanding the name.
For him he found my code harder to reason about because it was not explicit everywhere, but for me his was harder to reason about because I had to read the same thing over and over again with just different names.
But I wonder which one devtools would have handled easier, probably his.
If you haven’t tried Mobx it is definitely worth saving yourself thousands of lines of boilerplate in your next project.
People just don't write productive programs where the instruction sequencing at the function level is non-deterministic or chaotic. The UI is already insane enough with CSS and browser differences fighting you every step of the way to make it worse with clever preambles.
It's the same implicit call order you have when a language runtime allocate local variable on stack.
( 1 ) Operation can be applied multiple times -- result will not change (idempotant op) -- eg delete, select
( 2 ) Operation order is important (eg balance cannot increment before payment is processed )
( 3 ) operation order is not important, or ordering conflicts can be mitigated by the solution/underlying platform completely.
So what React team has realized, is that updating a state variable ( a change operation), often falls into ( 2 ).
As react getting more and more use, it tries to find more and more areas to optimize. Which is good.
In both time and ram-space dimensions...
For the React's run-time system, to perform global optimizations, it is really important to know what order the developer had implied in his/her design for case ( 2 ).
Very similar, to what an optmizing compiler, would like to know about a flow of calls/etc.
this is very difficult to do for a user level application in JS.
Without some help from the developer using the library, those optimizations cannot be done, or they will cause user's state to get corrupted.
Their solution is to keep the existing machinery as is, but allow a user to 'tell' the framework about the state variables a bit more than usual.
To me this this a fair tradeoff/ask.
So I will have to learn a bit more, and may be even restructure my code, to let React (and React Native) to do better global optimizations....
Why not ?!
Most programming languages syntax is poor as specifying the intended order of function invocation or value change rules, as 'compile-time' directive. (well, I at least, do not know of any language that let's me do that -- so I resort to forcing some order though function arguments and return type, so that a call to nxt function, must have a certain type provided by a return of a previous function...
I think explicit state management, is absolutely the correct problem to tackle. it is difficult and error prone.
It is not fair, in my view, to judge React added complexity in this area, as 'deterioration'.
Ideally these types of things should have been solved by the compilers .. but javascript (and browser) ecosystem is probably 10-15 years away from even thinking about this.
There are a million visual frontend builders out there, and they are all terrible, because you can never get them to do what you want. They are only usable to build example apps, and if used for anything real, require a huge amount of hacking around which results in code that is worse than what it would have been otherwise.
The reason I think it's important to mention this is because I believe that the amount of variability you have to deal with in the web is far greater, which is why I believe these visual frontend builder systems tend to fall apart.
Custom widgets? Amount of work to get them running in one of these is a nightmare.
Compare that to game engines such as Unity or UDK and their editors, it's so bad it's laughable.
I disagree. I had worked with Visual Basic and it had a great balance of ease of use and flexibility. If you are not obsessed with the feeling that you need to see the underlying code of the UI, you can have a great visual builder. Of course you need to code the event handlers, that's pretty much should be the coding required. I am talking about something like webflow + code for event handling.
>require a huge amount of hacking around which results in code that is worse than what it would have been otherwise.
that is because you haven't seen a great implementation yet. and as another commenter mentioned below, mobile UI builders are better because there is a uniformity in mobile design, while desktop (web) design lacks uniformity. It's possible.
There's nothing wrong with implicit call order when you only call it once.