Code Editor

Saving the instructions object in a variable is a nice way to illustrate how it works, but it basically never happens in practice. It's much more common to see something like this:

var React = require('react'); var ReactDOM = require('react-dom'); var MyComponentClass = React.createClass({ render: function () { return <h1>Hello world</h1>; } });

Select new.js, and compare it with this example. Notice how in both the example and in new.js, the instructions object that gets passed to React.createClass is exactly the same:

{ render: function () { return <h1>Hello world</h1>; } }

The only difference is where the instructions object is defined.

Report a Bug
If you see a bug or any other issue with this page, please report it here.