Hacker News new | ask | show | jobs
by aikah 4186 days ago
> He's not bashing React

I quote him

> React sucks

How do you call it? a constructive criticism ?

1 comments

If you look at the source code of React vs Mercury you might agree with him. Sucks is a strong word, however.

He's passionate about this stuff because there is a very simple mathematics to frontend development (both declarative UI and immutable state as a function of mutational events) that has been hiding in academic papers and haskell minds that is now coming to the forefront.

There is a better way, and it can reasoned about much better than other approaches.

You mean jQuery I suppose?
Not even the same things. I love React, use it everyday, however from a denotional semantic standpoint it is impure.

view m0 = r0

view (m1 = handler e0 m0) = r1

view (m2 = handler e1 m1) = r2

This is the essence of MVC. Mathematically pure and beautiful.

React and Flux are so close to this conceptually, but fall far short of it in actuality.

View is a function of state. State is an argument to view, and should not be mated to view in any other way except as a function call argument to the view - point free preferably.

If you look at the source code of React, there is an important object called Transaction. Transaction is basically AOP. AOP is not needed in JavaScript! Transaction reinvents functional composition. That is why things like Mercury, Mithrill, and Cycle are better,smaller, easier to read and reason about.

I love React, but it is a gateway to an even brighter future. Rejoice that the days of blind monkeys (myself included) writing UI code is coming to an end.

Yes exactly, just keep the state in css classes and html forms and tool yourself for reuse.