title: change input based on props or state in react
body: <p>I have a component that includes an input box.
  This component will receive a prop to initiate the value for input box.</p>
  
  <pre><code>class MyInput extends React.Component{
   constructor(props){
      super(props);
      this.state = {
          phrase : this.props.phrase
      }
   }
   onChange(e) {
      this.setState({
        phrase: e.target.value
      })
   } 
   render(){
     return &lt;input value={this.state.phrase}
             onChange={this.onChange.bind(this)}/&gt;
    }
  }
  </code></pre>
  
  <p>Now, I want to be able to change the value of the input box by changing props as well, but since I need the input to be in sync with state I have no idea how to do it.</p>