Answer the question
In order to leave comments, you need to log in
How to optimize this feature?
setAvatarState(image) {
if(image) {
this.setState({
avatars: image
});
}
this.setState({
imageUploadIsOpen: !this.state.imageUploadIsOpen
});
}
Answer the question
In order to leave comments, you need to log in
setAvatarState(image) {
this.setState({ avatars: image }, ()=>this.setState({ imageUploadIsOpen: !this.state.imageUploadIsOpen )}
}
Accidentally came here again and decided to answer, suddenly needed for the future.
setAvatarState(image) {
const obj = {
imageUploadIsOpen: !this.state.imageUploadIsOpen
}
if (image) obj['avatars'] = image
this.setState(obj);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question