我需要在內容存儲到數據庫之後清空反應組件中的輸入字段。這是我做過什麼至今: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