I am trying to clear a components state but can\'t find a reference for the es6 syntax. I was using:
state
this.replaceState(this.getInitialState());
This is the solution implemented as a function:
Class MyComponent extends React.Component { constructor(props) { super(props); this.state = this.getInitialState(); } getInitialState = () => ({ /* state props */ }) resetState = () => { this.setState(this.getInitialState()); } }