Live data from Hacker News

React v0.13.0 Beta 1

facebook.github.io

51–60 of 77 posts

Re: React v0.13.0 Beta 1

#51
post #25

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?

It wouldn't work with Typescript, but this is what my vanilla CoffeeScript React code looks like: div className: 'navbar-form' style: backgroundColor: "green" , div className: 'btn-group' , button type: 'button' className: 'btn btn-warning' onClick: @handleDecreaseWpmClick , span className: 'glyphicon glyphicon-chevron-down' span className: 'btn btn-default disabled' , "#{ @props.status.get('wpm') }" span className:…

Pretty sure you can lose all of those single line "," and make it a bit nicer.

    div
      className: 'navbar-form'
      style: 
        backgroundColor: "green"
      div
        className: 'btn-group'
        button
          type: 'button'
          className: 'btn btn-warning'
          onClick: @handleDecreaseWpmClick
          span
            className: 'glyphicon glyphicon-chevron-down'
        span
          className: 'btn btn-default disabled'
          "#{ @props.status.get('wpm') }"
          span
            className: 'hidden-xs'
            " wpm"
        button
          type: 'button'
          className: 'btn btn-warning'
          onClick: @handleIncreaseWpmClick
          span
            className: 'glyphicon glyphicon-chevron-up'

Re: React v0.13.0 Beta 1

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

My talk at React.js Conf is on exactly this topic: how to integrate React and TypeScript. For JSX the approach I recommend is a bit of a hack but works quite well. You basically tag the JSX in such a way that the IDE is happy. Then in a precompile step you find, transform, and replace the JSX[1] prior to passing to TypeScript for final compilation. You lose out on intellisense and autocompletion but you still get type-checking and can still use some ES6 features in your JSX like fat arrows.

1. https://github.com/jbrantly/ts-jsx-loader (for webpack, but basic approach works in gulp/grunt as well)

Re: React v0.13.0 Beta 1

#53
post #20

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?

Not what you're looking for exactly, but you could settle for using Jade? https://github.com/duncanbeevers/jade-react

Looks nice. Just a heads up though it uses React.DOM to create your tags which has been deprecated (and possibly won't be available anymore come 0.13).

Re: React v0.13.0 Beta 1

#54
post #23

Earlier quoted context omitted.

> seen some truly awful TS code (mainly where the devs want to pretend the web doesn't exist) I agree. Typescript is an impressive project, but most of the Typescript code I see looks more like C# or Java than Javascript. Sadly, it seems to have been created to accommodate that kind of approach. But there's a lot to be said for strong and static typing when dealing with large projects. That's why I'm hopeful for Flow…

Yeah the stuff I've seen looks to me like poorly written C# consciously written in a Web-ignorant style, thoroughly at odds with whats going on in the Web/JS community generally. Anyway totally agree on the typing angle, navigation/refactoring/discover-ability aspects are useful and I loved the implicit interface approach in Dart. However I wonder whether some of those features won't be added to JS over time (where p…

Could you give some examples of what you mean with "web ignorant"?

Re: React v0.13.0 Beta 1

#55

It's funny React gets bashed in this thread for pushing out createClass crutch, mixins, autobinding into userland, when usually it is being modularity shamed[0]. The change is subtle and easy to misinterpret. It's not that React drank ES6 class kool-aid and we're now gonna use inheritance over composition. (Nope[1], in fact pretty much the opposite[2].) The real change is that React.createClass is no longer the way t…

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

Re: React v0.13.0 Beta 1

#56

It's funny React gets bashed in this thread for pushing out createClass crutch, mixins, autobinding into userland, when usually it is being modularity shamed[0]. The change is subtle and easy to misinterpret. It's not that React drank ES6 class kool-aid and we're now gonna use inheritance over composition. (Nope[1], in fact pretty much the opposite[2].) The real change is that React.createClass is no longer the way t…

[deleted]

Re: React v0.13.0 Beta 1

#57

It's funny React gets bashed in this thread for pushing out createClass crutch, mixins, autobinding into userland, when usually it is being modularity shamed[0]. The change is subtle and easy to misinterpret. It's not that React drank ES6 class kool-aid and we're now gonna use inheritance over composition. (Nope[1], in fact pretty much the opposite[2].) The real change is that React.createClass is no longer the way t…

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...

Re: React v0.13.0 Beta 1

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

Re: React v0.13.0 Beta 1

#59
post #50

Earlier quoted context omitted.

After quite some consideration I chose to convert my ActionScript3 project to TypeScript. I knew I had to move away from flash for a while, and personally I really prefer to code big framework-like projects with static typing, so I gave it a go and it I have to say it has been really enjoyable. My code looks really neat, and unlike many other comments here, my code is very much targeted at the web and bound to how js…

Our problem with TypeScript is not TypeScript but its community and ecosystem for the most part (I think that's a way I would put it).

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 naive as this question may be, can you tell me more about what parts of the ecosystem or which community you mean?

Re: React v0.13.0 Beta 1

#60
post #31

I'm disappointed to see this prioritized over, say, a focus on reduced library size or simply getting to a stable 1.0 release. I'm not sure how this moves React forward, though I'm sure it's a "nice to have" for some people. Still, perhaps we'll learn more about the roadmap and goals of the team at the React conference this week.

The stuff announced is good/relevant b/c it signals some important decisions and allows other parties to weigh in in time for any major shifts to be made before 1.0.
Post reply on HN