Code Editor

Let's talk about the instructions that you pass to React.createClass!

For starters, these instructions should be stored in an object:

var instructions = {};

There is only one property that you have to include in this object: a render function.

A render function is a property whose name is render, and whose value is a function. The term "render function" can refer to the entire property, or to just the function part.

var instructions = { render: function () {} };

A render function must have a return statement. Usually, this return statement returns a JSX expression:

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

Of course, none of this explains the point of a render function. All you know so far is that its name is render, it needs a return statement for some reason, and you have to include it in the object that you pass to React.createClass. We'll get to the 'why' of it soon!

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