ESLint: Re-enable rule no-access-state-in-setstate (#10870)

* Re-enable rule no-access-state-in-setstate

* Move accessing event values out of async functions
This commit is contained in:
Kamil Gabryjelski
2020-09-21 08:48:23 +02:00
committed by GitHub
parent 3d8f757ac8
commit 4835d3b0a2
25 changed files with 83 additions and 71 deletions

View File

@@ -333,7 +333,7 @@ export default class AnnotationLayer extends React.PureComponent {
annotation.color =
annotation.color === AUTOMATIC_COLOR ? null : annotation.color;
this.props.addAnnotationLayer(annotation);
this.setState({ isNew: false, oldName: this.state.name });
this.setState(prevState => ({ isNew: false, oldName: prevState.name }));
}
}