title: How to remove spaces onPaste in reactjs
body: <p>How can I remove space from a string when pasted in a textfield in Reactjs using <code>onPaste event</code> so that the final string that appears inside the text field has no spaces in between.</p>
  
  <p>My HTML code is as follows:</p>
  
  <pre><code>&lt;input placeholder="Enter your First Name" onPaste={(event) =&gt; this.onFirstNamePaste(event)}/&gt;  
  </code></pre>
  
  <p>event handler:</p>
  
  <pre><code>onFirstNamePaste(event){
      var text = event.clipboardData.getData('Text')
      this.value = text.replace(/\s/g,'');
   }
  </code></pre>