Disclaimer: I wrote Mithril (one of the vdom frameworks mentioned in the presentation) I like the idea of reactive programming, but it tends to add a lot of indirection. This is theoretically desirable, but not necessarily pragmatic in reality. A lot of frontend code in the wild is of the throw-away-in-a-few-years nature and it's hard to get mindshare among developers if they're required to learn stuff that feels aca…
Don't React (Presentation - Use arrows to navigate)
81–90 of 105 posts
Re: Don't React (Presentation - Use arrows to navigate)
#82If you're writing proper tests for React, you don't test directly through the DOM. Using Jest you can mock the DOM to test parts of your component. In my view, a component should not contain everything, only the most essential parts to get a working example of how it functions. Reusable/general functionality is pulled in from mixins or other js modules, which should be testable, without the structure of React, on its own.
> Cannot have post processing steps
This is incorrect, you can create a post processing step in React with a parent component. I used this for a pointer events polyfill in React where it replaces `onPointerEvent` with the appropriate mouse or touch event on a child component.
> Cannot delay rendering after state/props change
You can delay a render by returning false from shouldComponentUpdate, and when you get to the point where you want to render you can use this.forceUpdate().
That being said, React is somewhat misleading as far as Reactive programming goes.
Re: Don't React (Presentation - Use arrows to navigate)
#83Re: Don't React (Presentation - Use arrows to navigate)
#84Clearly the author has never heard of ClojureScript's Om.
How does Om not suffer from the same problems? It's just an Clojurescript interface to React.
I wouldn't use React out of the box, for pretty much the very same reasons outlined in the slides.
Re: Don't React (Presentation - Use arrows to navigate)
#85People are really missing the point here. Follow staltz on twitter, he really knows his stuff. React is very good, however it missing a few key things that would make it awesome and more consistent - namely compositional event processing. Where React falls short from perfect is by using imperative code for its lifecycle functions. He's not bashing React, he's educating you about an even better way. If you care about…
Do I have some gripes with React's API? Sure. But it's a good start.
Re: Don't React (Presentation - Use arrows to navigate)
#86Earlier quoted context omitted.
> I'm not sure how you reconcile "React sucks" with "Om is the future" given that. Maybe it fixes all the sucky parts?
Not really. It's basically just a means of using ClojureScript with React. That comes with some great stuff (immutability, for one), but AFAIK it doesn't change anything too dramatically.
It completely changes the way you think about modelling applications and their events. It's closer to Flux on steroids rather than a thin wrapper on top of React.
Re: Don't React (Presentation - Use arrows to navigate)
#87Earlier quoted context omitted.
> He's not bashing React I quote him > React sucks How do you call it? a constructive criticism ?
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 reas…
Re: Don't React (Presentation - Use arrows to navigate)
#88Presentation author here. I should have taken this down before it popped up on HN or elsewhere. The video of this presentation is worth watching, because it's tongue-in-cheek through-out. But the slides are not worth reading, otherwise people take it seriously like it's happening here now. Cycle isn't the solution to everything, it's just one guy's ongoing experiment.
[1] https://github.com/joelhooks/react-rxjs-angular-di-todomvc
Re: Don't React (Presentation - Use arrows to navigate)
#89Earlier quoted context omitted.
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 reas…
You mean jQuery I suppose?
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.
Re: Don't React (Presentation - Use arrows to navigate)
#90He implies that Grunt is dead on the first slide. Well don't I feel stupid since I still use it. I guess it's not cool anymore? I missed the memo. Wait, maybe I'm not cool? What do the cool kids use now instead of Grunt?