Live data from Hacker News

React v0.13.0 Beta 1

facebook.github.io

1–10 of 77 posts

Re: React v0.13.0 Beta 1

#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. TypeScript with React, than this is a very big thing! Up until now, it was always a bit of a hassle, and with this change, it's completely straightforward (especially if you don't want JSX). You'll also need propTypes less because you can just use TypeScript interfaces for the `props` constructor parameter. Plus, TypeScript already has property initializers and all that, so all the other annoyances that you get when doing this with plain ES6 classes disappear with TypeScript.

I'm currently really considering porting my current project back to TypeScript for this single reason. The bad mix of TypeScript and JSX is what mostly holds me back. I'd like my view code to be somewhat understandable/hackable by designers and JSX really matters there. Any suggestions?

Re: React v0.13.0 Beta 1

#3
I'm a bit scared of what will replace mixins.

I've worked with C++ code bases where inheritance went crazy, and also with C++ code bases where composition via components was well supported and somewhat enforced. I'd love to see ES building in some kind of default support for composition with components if mixins are out.

See also how Unity3D does it: http://docs.unity3d.com/Manual/UsingComponents.html

I'm very happy to see JavaScript advancing, but I really hope we don't end up falling into the same holes other OOP languages fell into and then had to slowly educate and build themselves back out of again over the years. Frontend seems to be very good at rediscovering the old-new.

Re: React v0.13.0 Beta 1

#4
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.…

Similarly, I'm looking for a way to use react with HAML. I just can't give it up, I have absolutely no interest in closing my tags ever again.

One of the things I like about angular is how it deals with standard HTML. HAML doesn't care about its wacky attributes. Whats the best way to achieve this with react? Does the JSX compiler have hooks for preprocessing of any kind?

Re: React v0.13.0 Beta 1

#5
About mixins: the blog post mentions that "In fact, several features to support mixins were dropped from ES6 today." Does anyone know where these features were proposed/discussed/rejected?

Re: React v0.13.0 Beta 1

#6
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.…

Similarly, I'm looking for a way to use react with HAML. I just can't give it up, I have absolutely no interest in closing my tags ever again. One of the things I like about angular is how it deals with standard HTML. HAML doesn't care about its wacky attributes. Whats the best way to achieve this with react? Does the JSX compiler have hooks for preprocessing of any kind?

Well JSX is just compiled to JS so I guess you could have something that looks like HAML that substitutes the JSX code which in turn is compiled into JS.

Best place to start I guess would be to look into the JSX compiler to see how complicated that would be.

Re: React v0.13.0 Beta 1

#7
post #6

Earlier quoted context omitted.

Similarly, I'm looking for a way to use react with HAML. I just can't give it up, I have absolutely no interest in closing my tags ever again. One of the things I like about angular is how it deals with standard HTML. HAML doesn't care about its wacky attributes. Whats the best way to achieve this with react? Does the JSX compiler have hooks for preprocessing of any kind?

Well JSX is just compiled to JS so I guess you could have something that looks like HAML that substitutes the JSX code which in turn is compiled into JS. Best place to start I guess would be to look into the JSX compiler to see how complicated that would be.

Well if I can get the JSX compiler to give me a hook every time it finds an "html" block, and to let me replace it with my own content, then that would work fine I guess. Then it'd be a matter of getting JSX to recognise haml syntax as html.

Re: React v0.13.0 Beta 1

#8
post #3

I'm a bit scared of what will replace mixins. I've worked with C++ code bases where inheritance went crazy, and also with C++ code bases where composition via components was well supported and somewhat enforced. I'd love to see ES building in some kind of default support for composition with components if mixins are out. See also how Unity3D does it: http://docs.unity3d.com/Manual/UsingComponents.html I'm very happy…

There's a mixin proposal in the react-future repo:

https://github.com/reactjs/react-future/blob/master/01%20-%2...

Re: React v0.13.0 Beta 1

#9
post #5

About mixins: the blog post mentions that "In fact, several features to support mixins were dropped from ES6 today." Does anyone know where these features were proposed/discussed/rejected?

Must be ECMA standardization meeting that is ongoing (27-29 Jan) in San Francisco. Haven't seen the meeting minutes yet though.

Re: React v0.13.0 Beta 1

#10
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 should be rethinking though?

Post reply on HN