1.3.3 • Published 7 years ago

react-state-promise v1.3.3

Weekly downloads
281
License
MIT
Repository
github
Last release
7 years ago

react-state-promise

get a Promise from setState instead of using the idiot callback from facebook!

setState

import setState from 'react-state-promise';

class YourComponent extends Component {

  test() {
    setState(this, {
        running: true,
      })
      .then(({state, lastState}) => {
        if(state.running && !lastState.running) { .... }
      });
  }


  easy() {
    setState(this, {
        easy: true,
      })
      .then(() => {
        ......
      });
  }
}

you can also :

getNextState

import { getNextState } from 'react-state-promise';
....

getNextState(this)

and

willChange

import { willChange } from 'react-state-promise';
....

willChange(this, {aStatePart: true})
1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago