Created
September 18, 2018 17:36
-
-
Save profesor79/84a2754a853bd0308b36f9a4e7b8b271 to your computer and use it in GitHub Desktop.
how we can dry it?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resetSelectedState() { | |
const geoElement = Object.assign([], this.state.states); // create new copy to avoid mutation | |
geoElement.forEach((a) => a.isSelected = false); | |
this.setState({ states: geoElement }); | |
} | |
resetSelectedCountry() { | |
const geoElement = Object.assign([], this.state.countries); // create new copy to avoid mutation | |
geoElement.forEach((a) => a.isSelected = false); | |
this.setState({ countries: geoElement }); | |
} | |
resetSelectedContinent() { | |
const geoElement = Object.assign([], this.state.continents); // create new copy to avoid mutation | |
geoElement.forEach((a) => a.isSelected = false); | |
this.setState({ continents: geoElement }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment