1.0.0 • Published 9 years ago

react-state-inspector v1.0.0

Weekly downloads
2
License
ISC
Repository
-
Last release
9 years ago

react-state-inspector

A simple component to examine changes to state

example usage:

var React = require('react');
var StateInspector = require('react-state-inspector');

var MyComponent = React.createClass({
getInitialState: function () {
  return {
    stateVal: '',
    secondVal: []
  }
},

updateState: function(state) {
  this.setState(state);
},

render: function() {
  return (
    <div>
      <StateInspector state={ this.state } updateParentState={this.updateState} />
    </div>
  )
}
...

Accepted props:

state and optionally updateParentState which is a method to simply replace the parents state with past states which are saved in an array.

Has limited use cases but thats about as easy as it gets. Mostly an experiment to help me wrap my mind around the possiblitiess of React and one way data flow/flux.

Thank you to Ryan florence and Michael Jackson for inspiration!

1.0.1

9 years ago

1.0.0

9 years ago