Created
February 20, 2019 12:11
-
-
Save suneg/c7eda618cbd8c7831711c1ec4cbc0232 to your computer and use it in GitHub Desktop.
Revisions
-
suneg created this gist
Feb 20, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ // How to clear the state of the current component // (set all state properties to undefined) let clearerObject = Object.keys(this.state).reduce((prev, k) => { prev[k] = undefined; return prev }, {}); this.setState({ ...clearerObject });