I am trying to clear a components state but can\'t find a reference for the es6 syntax. I was using:
this.replaceState(this.getInitialState());
First, you'll need to store your initial state when using the componentWillMount() function from the component lifecycle:
componentWillMount() {
this.initialState = this.state
}
This stores your initial state and can be used to reset the state whenever you need by calling
this.setState(this.initialState)