2.0.2 • Published 7 years ago

react-state-data v2.0.2

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

react-state-data

How to install

$ npm install react-state-data
Or
$ yarn add react-state-data

How to use

import reactStateData from 'react-state-data'

@reactStateData
class View extends React.Component {
  constructor(props) {
    super(props)

    this.setData({
      count: 0
    }, this.watch)
  }

  watch() {
    return {
      count(val, oval) {
        console.log(val, oval)
      }
    }
  }

  render() {
    return (
      <div>
        <p>{ this.data.count }</p>
        <button onClick={ e => this.data.count++ }>click me</button>
      </div>
    )
  }
}

export default View

Don't like '@'?

import reactStateData from 'react-state-data'

class View extends React.Component {
  ...
  ...
  ...
}

export default reactStateData(View)
2.0.2

7 years ago

2.0.1

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.0

7 years ago