Live data from Hacker News

React v0.12

facebook.github.io

21–30 of 79 posts

Re: React v0.12

#21
A sincere and big thank you for building and evolving this awesome tool that simplified UI madness in browsers. :-)

Re: React v0.12

#22
post #5

I don't know if I'm reading the changes wrong, but I'm not liking how I have to do an extra step if I don't use jsx. I want to use coffescript and not have to do extra stuff. I definitely feel this forced vibe around making everyone use jsx, but have yet to hear any compelling reasons why it's better.

Hi, this was a tough call for us to make. We wanted to everything we could to avoid extra bloat for everyone. In the end, most people tend to use some kind of extra helper, even if it's not JSX. E.g. a custom library or another third party language. One reason for this change is to make it possible to use object literals or record syntax where that is more appropriate than function calls. We don't currently recommend…

Thanks for the response.

Could you give me a quick example of calling a component with object literals instead of functions? I'm not understanding how that will play out in the final code.

Also, isn't it just adding React.createFactory, not replacing React.createClass?

Re: React v0.12

#23
post #5

I don't know if I'm reading the changes wrong, but I'm not liking how I have to do an extra step if I don't use jsx. I want to use coffescript and not have to do extra stuff. I definitely feel this forced vibe around making everyone use jsx, but have yet to hear any compelling reasons why it's better.

Hi, this was a tough call for us to make. We wanted to everything we could to avoid extra bloat for everyone. In the end, most people tend to use some kind of extra helper, even if it's not JSX. E.g. a custom library or another third party language. One reason for this change is to make it possible to use object literals or record syntax where that is more appropriate than function calls. We don't currently recommend…

More information in breaking changes would definitely be appreciated.

I can't decode what "Composite Component functions can no longer be called directly" means exactly in terms of code that will no longer work.

I definitely use React without JSX in plain JavaScript and I really love it. I'm kind of dreading what this little snippet means when I try to update to 0.13.

Re: React v0.12

#24
post #22

Earlier quoted context omitted.

Hi, this was a tough call for us to make. We wanted to everything we could to avoid extra bloat for everyone. In the end, most people tend to use some kind of extra helper, even if it's not JSX. E.g. a custom library or another third party language. One reason for this change is to make it possible to use object literals or record syntax where that is more appropriate than function calls. We don't currently recommend…

Thanks for the response. Could you give me a quick example of calling a component with object literals instead of functions? I'm not understanding how that will play out in the final code. Also, isn't it just adding React.createFactory, not replacing React.createClass?

In CoffeeScript it might look something like this:

element = type: 'div' props: className: 'container', children: [ type: 'span', props: className: 'foo' type: CustomClass, props: className: 'bar' ]

(This doesn't fully work in 0.12 because we also have some extra properties on there but that's the direction we're going.)

0.12 is just adding React.createFactory. 0.13 will optionally replace React.createClass.

We do this so that there's a seamless upgrade path. We have to remove the warnings to fix the classes.

Re: React v0.12

#25
post #5

I don't know if I'm reading the changes wrong, but I'm not liking how I have to do an extra step if I don't use jsx. I want to use coffescript and not have to do extra stuff. I definitely feel this forced vibe around making everyone use jsx, but have yet to hear any compelling reasons why it's better.

Big-R (the react framework I've been working on) eases this transition a bit. You can see[1] that components aren't accessed directly (unless of course you want to)

It still doesn't solve the stuff JSX has for splats though ...

[1]: https://gist.github.com/mikew/e737273e42ed704c6c54#file-zz-r...

Re: React v0.12

#27
post #6

Can someone explain what the "spread operator" is and how to use it?

https://gist.github.com/sebmarkbage/07bbe37bc42b6d4aef81

Wow, the example in that gist:

  var component = ;
Wha?? For me, there's a point in a language where the benefits of syntactic sugar are outweighed by readability concerns.

Re: React v0.12

#28
I don't get the React.isValidComponent -> React.isValidElement change. Wasn't "class" the name of the abstract idea of component and "component" the name of the actually rendered component, the class materialized in a DOM?

Re: React v0.12

#29
I really don't see the point of making so much breaking changes just to simplify the public API. The thing was working, it was good. It didn't need any changes. God would have rested.

But well, the developers were there and, you know, they cannot see a repository without commits for much time, right?

Re: React v0.12

#30
post #22

Earlier quoted context omitted.

Thanks for the response. Could you give me a quick example of calling a component with object literals instead of functions? I'm not understanding how that will play out in the final code. Also, isn't it just adding React.createFactory, not replacing React.createClass?

In CoffeeScript it might look something like this: element = type: 'div' props: className: 'container', children: [ type: 'span', props: className: 'foo' type: CustomClass, props: className: 'bar' ] (This doesn't fully work in 0.12 because we also have some extra properties on there but that's the direction we're going.) 0.12 is just adding React.createFactory. 0.13 will optionally replace React.createClass. We do th…

I guessed that indentation:

    element =
      type: 'div'
      props: className: 'container'
      children: [
          type: 'span'
          props: className: 'foo'
      ,
          type: CustomClass
          props: className: 'bar' 
      ]
Post reply on HN