我想将状态值的一些详细信息保存到firestore中。我该如何实现??
状态详细信息
state = {
loading: false,
sp_name: '',
sp_Phone: '',
sp_Role: '',
sp_Location: '',
sp_Service: '',
sp_country: '',
sp_message: '',
sp_License: ''
}
我不想将加载状态保存到Firestore。
处理提交事件。
handleSubmit = (e) => {
e.preventDefault();
this.setState({ loading: true })
let uid = this.props.auth.uid;
this.props.UpdateUser(uid, this.state)
this.setState({ loading: false })
toast("Registered Successfully.!", { type: toast.TYPE.INFO, autoClose: 5000 });
}
答案 0 :(得分:0)
handleSubmit = (e) => {
e.preventDefault();
this.setState({ loading: true })
const stateObj = this.state;
delete stateObj['loading'];
let uid = this.props.auth.uid;
this.props.UpdateUser(uid, stateObj)
this.setState({ loading: false })
toast("Registered Successfully.!", { type: toast.TYPE.INFO, autoClose: 5000 });
}