Skip to content

Conversation

spencerjanssen
Copy link
Contributor

According to React's docs:

setState() does not immediately mutate this.state but creates a
pending state transition. Accessing this.state after calling this
method can potentially return the existing value.

To make sure that transformState gets the latest value, we use
setState's callback mode.

transformState now returns Unit instead of the state type.

According to React's docs:

  setState() does not immediately mutate this.state but creates a
  pending state transition. Accessing this.state after calling this
  method can potentially return the existing value.

To make sure that transformState gets the latest value, we use
setState's callback mode.

transformState now returns Unit instead of the state type.
function transformState(this_){
return function(update){
return function(){
this_.setState(function(old, props){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this form is actually getting the state?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, modifying, I see.

@ethul
Copy link
Contributor

ethul commented Feb 26, 2016

Looks good to me. Thanks for the update on this.

@paf31 Good to merge in? I can bring this in when I add #61

@paf31
Copy link
Contributor

paf31 commented Feb 27, 2016

👍 Yes, looks good.

ethul added a commit that referenced this pull request Feb 29, 2016
Fix transformState to use current state
@ethul ethul merged commit 75bc88b into purescript-contrib:master Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants