Bu yasal mı?React - setState bileşendeWillReceiveProps
componentWillReceiveProps: function(nextProps) {
if (typeof nextProps.contact != 'undefined') {
this.setState({forename: nextProps.contact.forename});
this.setState({surname: nextProps.contact.surname});
this.setState({phone: nextProps.contact.phone});
this.setState({email: nextProps.contact.email});
}
}
Girişlerimi nasıl dolduracağımı bilmiyorum ve yine de kullanıcının girdileri düzenleyebileceğini biliyorum. Bu yüzden bu çözüme manipüle etmeye çalışmak yerine bu çözümü buldum.
Herhangi bir öneriniz var mı?