title: Updating Parent Component via Child Component in React Native
body: <p>I have a parent component and two child components. One of the child components is a form with an <code>add</code> button. I am able to capture the text when <code>add</code> button is pressed, but stuck when trying to pass that value to the parent component, update the array in parent component and re-render the view.</p>
  
  <p><strong>Parent Component:</strong></p>
  
  <pre><code>var Tasks = ['Competitor Study','Content Plan','Write','Promote','Consumer Research']
  
  //Build React Component
  class MyTaskList extends Component {
  
  render() {
      return (
        &lt;View style={styles.container}&gt;
           &lt;Text style={styles.titleStyle}&gt;
            My Tasks  
            {"\n"} 
              ({Moment().format("MMM Do YY")})
            {"\n"}
          &lt;/Text&gt;
          &lt;AddTask /&gt;
          {this.workitems()}
        &lt;/View&gt;
      );
    }
  
    workitems() {  
     return (Tasks.map(function(workitem,i) {
      return &lt;ListItem key={i} workitem={workitem} /&gt;
          }
        )
      );  
    }
  
  }
  </code></pre>
  
  <p><strong>Child component with the form</strong></p>
  
  <pre><code>class AddTask extends Component {
  
      constructor(props) {
        super(props);
        this.state = {
          enterTask: 'Enter task'
        };
      }
  
      onTaskTextChanged(event) {
        this.setState({ enterTask: event.nativeEvent.text });
      }
  
      onAddPress() {
       var newtask = this.state.enterTask;
       console.log('new task - '+newtask);
      }
  
      render() {
          return (
              &lt;View style={styles.addTask}&gt;
                     &lt;TextInput
                      style={styles.taskInput}
                      value={this.state.enterTask}
                      onChange={this.onTaskTextChanged.bind(this)}
                      placeholder='Enter task'/&gt;
                   &lt;TouchableHighlight style={styles.button}
                      onPress={this.onAddPress.bind(this)}
                      underlayColor='#99d9f4'&gt;
                      &lt;Text style={styles.buttonText}&gt;Add&lt;/Text&gt;
                  &lt;/TouchableHighlight&gt;
              &lt;/View&gt;
          );
      }
  }
  </code></pre>