React: Get initialstate after state has changed
javascript, reactjs
Solution
No, the initial state isn't stored -- but you can call `this.getInitialState()` if you want to reexecute the function.
Problem
Is it possible to retrieve the initial state after the state has changed? F.ex: ``` React.createClass({ getInitialState: function() { return { foo: 'bar' } }, componentWillMount: function() { this.setState({ foo: 'foo' }) }, componentDidMount: function() { // get the initial state "bar" ? } }) ``` I couldn’t find anything in the docs. I could of course save the value in an external variable, but I was just curios if it was possible to treat the initialstate as a "config" object that could be re-used.