import React from 'react';

class App extends React.Component {

  constructor() {
    super();
    this.state = {
      txt: 'this is my state',
      cat: 0
    }
  }

  update(e) {
    this.setState({txt: e.target.value});
  }

  render() {
    let txt = this.props.txt;
    return (
      <div>
        <Widget update={this.update.bind(this)} />
        <Widget update={this.update.bind(this)} />
        <Widget update={this.update.bind(this)} />
        <h1>{this.state.txt}</h1>
      </div>
    )
  }
}

const Widget = (props) =>
  <input type="text" onChange={props.update}/>

// Do have state
// class App extends React.Component {
//   render() {
//     return React.createElement('h1', null, 'Hello New');
//   }
// }

// Do not have state
// const App = () => <h1>Hello Stateless</h1>

export default App

@@ -61,448 +61,66 @@
 t %7B%0A
-%0A  constructor() %7B%0A    super();%0A    this.state = %7B%0A      txt: 'this is my state',%0A      cat: 0%0A    %7D%0A  %7D%0A%0A  update(e) %7B%0A    this.setState(%7Btxt: e.target.value%7D);%0A  %7D%0A%0A  render() %7B%0A    let txt = this.props.txt;%0A    return (%0A      %3Cdiv%3E%0A        %3CWidget update=%7Bthis.update.bind(this)%7D /%3E%0A        %3CWidget update=%7Bthis.update.bind(this)%7D /%3E%0A        %3CWidget update=%7Bthis.update.bind(this)%7D /%3E%0A        %3Ch1%3E%7Bthis.state.txt%7D%3C/h1%3E%0A      %3C/div%3E%0A    )
+  render() %7B%0A    return %3CButton%3EI %3CHeart /%3E React%3C/Button%3E
 %0A  %7D
@@ -133,14 +133,14 @@
 nst 
-Widget
+Button
  = (
@@ -156,82 +156,53 @@
 %0A  %3C
-input type=%22text%22 onChange=%7Bprops.update%7D/%3E%0A%0A// Do have state%0A// 
+button%3E%7Bprops.children%7D%3C/button%3E%0A%0A
 class 
-App
+Heart
  ext
@@ -224,19 +224,16 @@
 onent %7B%0A
-// 
   render
@@ -241,147 +241,48 @@
 ) %7B%0A
-//
     
- 
 return 
-React.createElement('h1', null, 'Hello New');%0A//   %7D%0A// %7D%0A%0A// Do not have state%0A// const App = () =%3E %3Ch1%3EHello Stateless%3C/h1%3E
+%3Cspan%3E&hearts;%3C/span%3E%0A  %7D%0A%7D%0A%0A
 %0A%0Aex

Access Nasted Data