Another way of fixing this is by changing the key
of the input.
<input ref="text" key={this.state.awayMessage ? 'notLoadedYet' : 'loaded'} onChange={this.onTextChange} defaultValue={awayMessageText} />
Update:
Since this get upvotes, I will have to say that you should properly have a disabled
or readonly
prop while the content is loading, so you don’t decrease the ux experience.
And yea, it is most likely a hack, but it gets the job done.. 😉