@ -36,8 +36,8 @@ Let's look at a really simple example. Create a `hello-react.html` file with the
For the rest of the documentation, we'll just focus on the JavaScript code and assume it's inserted into a template like the one above. Replace the placeholder comment above with the following JSX:
```javascript
var HelloWorld = React.createClass({
render: function() {
class HelloWorld extends React.Component {
render() {
return (
<p>
Hello, <inputtype="text"placeholder="Your name here"/>!
@ -45,14 +45,16 @@ var HelloWorld = React.createClass({
@ -110,13 +110,12 @@ In most cases, this can be sidestepped by hiding elements instead of destroying
The situation gets more complicated when the children are shuffled around (as in search results) or if new components are added onto the front of the list (as in streams). In these cases where the identity and state of each child must be maintained across render passes, you can uniquely identify each child by assigning it a `key`:
```javascript
render: function() {
var results = this.props.results;
render() {
return (
<ol>
{results.map(function(result) {
return <likey={result.id}>{result.text}</li>;
})}
{this.props.results.map((result) => (
<likey={result.id}>{result.text}</li>
))}
</ol>
);
}
@ -128,41 +127,41 @@ The `key` should *always* be supplied directly to the components in the array, n