Fix word form not clearing

This commit is contained in:
Robbie Antenesse 2017-05-18 22:27:16 -06:00
parent 3625317b15
commit 74956c06f6
2 changed files with 9 additions and 4 deletions

View File

@ -25,6 +25,12 @@ export class IPAField extends Component {
this.field = null;
}
componentWillReceiveProps (nextProps) {
this.setState({
value: nextProps.value
});
}
showHelp () {
if (this.state.doShowHelp) {
return (

View File

@ -98,7 +98,7 @@ export class WordForm extends Component {
</p>
</div>
<IPAField
<IPAField value={this.state.wordPronunciation}
onChange={newValue => this.setState({ wordPronunciation: newValue })} />
<div className='field'>
@ -143,11 +143,10 @@ export class WordForm extends Component {
<p className='control'>
<textarea className={`textarea${(!this.state.detailsIsValid) ? ' is-danger' : ''}`}
placeholder='Explanation of word (Markdown enabled)'
value={this.state.wordDetails}
onChange={(event) => {
this.setState({ wordDetails: event.target.value });
}}>
{this.state.wordDetails}
</textarea>
}} />
{(!this.state.detailsIsValid)
? (
<span className='help is-danger'>