To perform an action immediately after setting state on a state variable and then returning a result, a callback will be useful. (#1229)

* Update Editor.jsx

* fixed typo
This commit is contained in:
SAI SUMANTH KUMAR 2021-10-24 19:45:37 +05:30 committed by GitHub
parent a27d603ea3
commit 1f1cd70175
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -462,7 +462,7 @@ class Editor extends React.Component {
};
toggleQueryEditor = () => {
this.setState({ showQueryEditor: !this.state.showQueryEditor });
this.setState((prev) => ({ showQueryEditor: !prev.showQueryEditor }));
this.toolTipRefHide.current.style.display = this.state.showQueryEditor ? 'none' : 'flex';
this.toolTipRefShow.current.style.display = this.state.showQueryEditor ? 'flex' : 'none';
};
@ -490,7 +490,7 @@ class Editor extends React.Component {
};
toggleQuerySearch = () => {
this.setState({ showQuerySearchField: !this.state.showQuerySearchField });
this.setState((prev) => ({ showQuerySearchField: !prev.showQuerySearchField }));
};
onVersionDeploy = (versionId) => {