コンテンツがDBに格納された後、反応コンポーネントの入力フィールドを空にする必要があります。これは私がこれまでにやったことです:ReactJS:値を処理した後の空の入力フィールド
addPost (event) {
const content = event.target.value
methodInsert.call(
{ content },
(error) => {
if (!error) {
event.target.value = ''
}
}
)
}
<Input
onBlur={this.addPost.bind(this)}
/>
私はエラーに
Warning: This synthetic event is reused for performance reasons.
If you're seeing this, you're accessing the property `target` on a released/nullified synthetic event. This is set to null.
If you must keep the original synthetic event around, use event.persist().
グレート:
はここでこれを達成することができる方法の一例です!そして何が問題なの? – PeterMader
入力を制御し、setStateを空の文字列にします。 – SamHH
@PeterMader更新されたポストを参照 – user3142695