title: How to preserve cursor position on textarea text change?
body: <p>I'm trying to implement a textarea which automatcally inserts close parens in React, but whenever I modify the textarea's value property, the cursor jumps to the end of the text being edited.</p>
  
  <p>Here's my onChange function:</p>
  
  <pre><code>    //on change
      function(event) {
  
          var newText =  event.target.value
  
          var cursorPosition = getCursorPosition(event.target)
          if(lastCharacterWasParen(newText, cursorPosition)){
              newText = newText.slice(0, cursorPosition) + ')' + newText.slice(cursorPosition)
          }
  
          this.setProps({text: newText}})
  
      }
  </code></pre>
  
  <p>This successfully inserts the paren, but how do I preserve the cursor position?</p>