by coldtea · 11y ago · 0 comments
The author understands React quite well, it's this comment that, while also understanding React, misses the author's point by insisting on the superficial differences.
>It does actually - you update the state, then React propogates the changes for you through it's props mechanism.
That it achieves something (change propagation) it doesn't mean it's the solution to that thing. There's a reason the author used the wording "doesn't solve" (instead of "doesn't handle", "doesn't allow" etc). Flux (and it's variations) is what really solves propagation in React without it becoming a tangled mess.
>Flux is not message passing
Nobody said it is.
>React components do not redraw themselves
They do, that's the whole point. React components manage, compose and return their DOM representation structure which is the HTML analogous to "drawing". return(<b>{msg}</b>) IS drawing.
The fact that they don't have low level rendering code embedded in them is just an implementation detail (because of course the DOM already exists).
>React provides the view as a function of state. Windows is nothing like that.
Only the author doesn't mention Windows, the abstract OS, he mentions a specific implementation of its UI engine that clearly provides the view as a function of state.
Similar miscomprehensions of the article drive the other objections.
But that's not especially important when it comes to React in general. The important is that the "how to draw myself" (in a high level) never leaves the view, not whether the "drawing instuctions" happen inside the app (as low level draw commands) or outside (by a mechanism that handles composable values representing markup).
In both cases the view is a black box -- in that nobody else determines it's layout/style/contents. Whether somebody else or the view itself draws them might reflect a functional vs more imperative style, but it's not the key benefit of react.
In fact there are React implementations like React-Canvas that don't use the DOM/diffing mechanism at all -- they just invalidate the whole top level "viewport".
Serious question, and I'm not a Windows programmer, I might be missing something.
One is a lot easier to unit test than the other, for example.
That's a red herring. That would be relevant if we were discussing the imperative vs functional methodology.
But what the article discusses is the similarity in the architecture of two view management systems.
And even more so, the imperative changes in the Windows scheme described are encapsulated inside the views, and the overall system is more functional that you give it credit for. But, again, I think that this is beside the point.
https://facebook.github.io/react/docs/component-api.html#for...