In Part 1 of this series, we built our Greeting component that took a name parameter and rendered this onto the screen. Here’s what the snippet for this looked like:

var Greeting = createReactClass({

"render": allowInteropCaptureThis(

(ReactClassInterface self) => React.createElement(

'h1', 'null, ['Hello, ${getProperty(self.props, 'name')}]),

)

});

And we used it by doing:

void main() {

ReactDOM.render(

React.createElement(

Greeting,

makeJsObject({

'name': 'John'

}),

null,

),

querySelector('#output'),

);

}

In this part, we will refactor our solution and proceed to build out the Stateful Component example. Here’s the full video:

→ Watch on YouTube

→ Get the source code