4 ms·
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 wil
by jbhatab 12y ago
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?
- sebmarkbage 12y agoIn 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.
- kaoD 12y agoI guessed that indentation: element = type: 'div' props: className: 'container' children: [ type: 'span' props: className: 'foo' , type: CustomClass props: className: 'bar' ]
- jbhatab 12y agoThanks for the answers. I will say that I do really like the syntax of coffeescript as is though, div className: 'container', span className: 'foo' CustomClass classname: 'bar' It reminds me a lot of slim and reads nicely.