title: How to pass state back to parent in React?
body: <p>I have a form that has a submit button.
  That form calls a function onclick that sets the state of something from false to true.
  I then want to pass this state back to the parent so that if it is true it renders componentA but if it is false it renders componentB.</p>
  
  <p>How would I do that in react?
  I know I need to use state or props but not sure how to do it. also is this contradicting the one-way flow react principle??</p>
  
  <p>ComponentA code:</p>
  
  <pre><code>&lt;form onSubmit={this.handleClick}&gt;
  
  
  handleClick(event) {
      this.setState({ decisionPage: true });
      event.preventDefault();
    };
  </code></pre>
  
  <p>Parent component that controls what it displays:</p>
  
  <pre><code>return (
        &lt;div&gt;
        {this.props.decisionPage ?
          &lt;div&gt;
            &lt;LoginPage /&gt;
          &lt;/div&gt;
          :
          &lt;div&gt;
            &lt;Decision showThanks={this.props.showThanks}/&gt;
          &lt;/div&gt;
        }
        &lt;/div&gt;
      )
  </code></pre>