Live data from Hacker News

React v0.13.0 Beta 1

facebook.github.io

71–77 of 77 posts

Re: React v0.13.0 Beta 1

#71

Personally I don't see why I would go back to using classes. IMHO, classic OOP doesn't fit to modern JS. I guess it's good to have the option though.

> IMHO, classic OOP doesn't fit to modern JS.

ES6 classes aren't "classic OOP", they're syntax sugar for regular prototypal inheritance that JavaScript has had forever.

Re: React v0.13.0 Beta 1

#72
post #58

Excited for the release, but disappointed in the embracing of OO programming in Javascript. Object oriented programming is a poor way to express logic and gets away from the beauty of languages like Javascript (and Perl) - functional composition. I deeply regret the day when all job postings for Javascript say "Looking for an object-oriented Javascript developer", since like lemmings companies think object-oriented p…

All the React code I've written tends to be much more functional/declarative in nature than OO. When writing web frontend code, there is the giant blob of state known as the DOM that has to be dealt with in some way. More than anything else, React allows you to treat the view as "create a function that transforms data into DOM elements", handling the state diffs itself.

When MVC is expressed as a composition of functions - whose purpose is data transformation, it is an absurdly simple concept.

Only MVC described in object-oriented terms is "hard".

view(controller(model0,event0)) = representation

Re: React v0.13.0 Beta 1

#73
post #69

Earlier quoted context omitted.

It's the first time I heard that, though I admit I'm not really actively involved in any type of TS community. All I've been in contact with are the TS releases and blogpost from the TS development team, for which I can only give credits (quite fast and stable development with good features), and some TS projects and definition files for existing libraries I found on github which were pretty decent and helpful. As na…

The homepage, forums and press releases do seem really focus on Visual Studio. I guess that's understandable given it's an MS product. There are a couple of links to editor syntax files and a link to WebStorm but they're a bit of an after thought. I keep expecting the homepage update "any day now" but so far I've only really seen VS mentioned as a default environment.

Ah yes, true. I've always thaught of it as understandable that they focus on Visual Studio, but I too would much appriciate it if they would push that a bit less. I did try the free version of VS when I started with TS, but I didnt prefer it to webstorm, even though in some small details, the ts support may be slightly better.

Re: React v0.13.0 Beta 1

#74
post #2

Nice! I think that if you use vanilla JS (even ES6), the class support adds more hassle than the gains it provides. For example, setting proptypes completely at the bottom of the file seems, well, cumbersome. It's a bit like putting a function signature after the function body. From that perspective, using the old React.createClass syntax seems to keep everything together a bit nicer. However, if you want to use e.g.…

Maybe off topic but I've been wondering whether many people are finding spending time on TS worthwhile? Given the improvements in ES6, the fact that the JS community in general is so active, and the fact that I've seen some truly awful TS code (mainly where the devs want to pretend the web doesn't exist) I've been put off exploring TS too far much (beyond looking at the basic language features). I'm not sure if I sho…

I'm just too lazy to write the tests that a type checker will do for me. It's not just laziness though it's the idea of writing all that redundant code. (Too lazy to reverse engineer typeless code too)

Re: React v0.13.0 Beta 1

#76
That coffeescript / JSX example from the blog post looks sooo sweet.

  render: ->
    div(onClick: @tick, 'Clicks: ', @state.count)
I couldn't find any transformers which support it. Is there anyone out there?

Re: React v0.13.0 Beta 1

#77

Earlier quoted context omitted.

Given the ES3 style creation if components (which appears to have no "superclass"), can you also just do "class MyComponent" (no "extends React.Component"?)

I think so, but you'll probably miss `this.setState`. They are moving out `setState` into a sideways module[1] so I assume full-featured classes without React.Component should be possible in the future. [1]: https://github.com/facebook/react/commit/ed7332c74921874cdcb...

Indeed, it is not necessary to inherit form React.Component, see confirmation:

https://github.com/facebook/react/pull/2975#issuecomment-729...

Post reply on HN