Understanding how it works will take time and will slow you down at first (but once you and your team get it, things will start happening much faster)
Most important terms in React
Components are self-contained reusable building blocks of web application.
React components are basically just idempotent functions (same input produces same output).
They describe your UI at any point in time, just like a server-rendered app.
var React = require('react'),
SimpleView = React.createClass({
render: function () {
return <h1><strong>Example 1:</strong> A simple component</h1>;
}
});
React.renderComponent(SimpleView(), document.getElementById('example'));
render: function() {
var someProp = 'bar';
console.log('component render()', this.props);
return <div>
<AnotherComponent foo={someProp} model={this.props.model} />
</div>;
}
render: function() {
return <h3>Click count:
<span className='label label-default'>{this.state.clicks}</span>
</h3>;
}
/** @jsx React.DOM */
render: function () {
return <div>
<h2>
<strong>Example 4:</strong> React App
</h2>
</div>;
}
/** regular DOM */
render: function () {
return React.DOM.div(null,
React.DOM.h2(null, React.DOM.strong(null, "Example 4:"), " React App")
);
}
Alexander Farennikov
Sr. Software Engineer at Teradek LLC (www.teradek.com)
www.linkedin.com/in/farennikov/en
farennikov@gmail.com
My UI team in Odessa, Ukraine:
- Denis Turenko
- Pavel Mashchenko