title: React: Trasform submit button on click
body: <p>In my render I have:</p>
  <pre><code>render(){
   return (
  //.....
  
  &lt;this.Content&gt;
  
  //...
  </code></pre>
  <p>in Content I have all the parts that I show to user and at the end I have:</p>
  <pre><code>Content = props =&gt; {
  return(
  //..
  
     &lt;Submit
              onSubmit={self.props.handleSubmit(values =&gt; self._onSubmit(values))}
              /&gt;
  )}
  </code></pre>
  <p>Now my problem is when the submit button has clicked I would to change it with:</p>
  <pre><code>&lt;Spinner animation=&quot;border&quot; variant=&quot;primary&quot; /&gt;
  </code></pre>
  <p>How can I do?</p>
  <p>EDIT.</p>
  <pre><code> constructor(props){
      super(props);
      this.state = {
           wasButtonClicked: false,
      }
  
    Content = props =&gt; {
      return(
       //
            {this.state.wasButtonClicked == true ? &lt;Spinner animation=&quot;border&quot; variant=&quot;primary&quot; /&gt; : &lt;Submit   onSubmit={self.props.handleSubmit(values =&gt; {this.setState({wasButtonClicked: true}),self._onSubmit(values)})}   /&gt;}
              /&gt;
      }
  
  
  render() {
  return(
  //
    this.state.HasEmail === true
                ?
                &lt;this.Content /&gt;
                :
  </code></pre>