score:20

Accepted answer

I tried contacting the packager, which says it listens on port 8081 and also says that it is getting requests for index.ios.bundle as it runs.

So I put this in my browser: http://localhost:8081/index.ios.bundle

In the returned bundle, I found:

var wazoo = React.createClass({displayName: "wazoo",
  render: function() {
    return (
        React.createElement(View, {style: styles.container}, 
          React.createElement(ScrollView, null, 
            React.createElement(View, null, 
                React.createElement(Text, {style: styles.welcome}, 
                  "Wazoo"
                ), 

And so on. So it looks like View, ScrollView etc. are just like components as defined as usual in Web React, and the above code is the JS equivalent to the JSX.

score:0

I know it's been a while since the original question but, in case someone else is interested, you could check the library we made at Uqbar:

https://www.npmjs.com/package/njsx

It's quite easy to use and provides a cleaner interface than the React out-of-the-box interface.

score:16

Daniel Earwicker's solution is correct, but we can use Factories to make it more readable:

var View       = React.createFactory(React.View);
var ScrollView = React.createFactory(React.ScrollView);
var Text       = React.createFactory(React.Text);

var wazoo = React.createClass({displayName: "wazoo",
  render: function() {

    return View({style: styles.container}, 
      ScrollView(null, 
        View(null, 
          Text({style: styles.welcome}, 
            "Wazoo"
          )
        )
      )
    );


  }
});

Related Query

More Query from same tag