Skip to content

Topic/lifecycle methods#39

Merged
paf31 merged 2 commits into
purescript-contrib:masterfrom
ethul:topic/lifecycle-methods
Aug 31, 2015
Merged

Topic/lifecycle methods#39
paf31 merged 2 commits into
purescript-contrib:masterfrom
ethul:topic/lifecycle-methods

Conversation

@ethul

@ethul ethul commented Aug 29, 2015

Copy link
Copy Markdown
Contributor

Some of the lifecycle methods did not pass along the arguments from React. I've added these arguments. I realize this is a breaking change and I am definitely open to discussion. But I thought they might be handy.

ethul added 2 commits August 29, 2015 13:41
 - componentWillReceiveProps(nextProps)
 - shouldComponentUpdate(nextProps, nextState)
 - componentWillUpdate(nextProps, nextState)
 - componentDidUpdate(prevProps, prevState)
@paf31

paf31 commented Aug 31, 2015

Copy link
Copy Markdown
Contributor

They don't, but you can get them with getState and getProps. This might be better though.

@ethul

ethul commented Aug 31, 2015

Copy link
Copy Markdown
Contributor Author

I think using getState and getProps would give a different result in these lifecycle methods.

For example in componentWillReceiveProps if you did getProps, I think this would yield the current props. But the props passed in as a param would be the next props.

Same goes for the others. For instance, check out the code example for shouldComponentUpdate.

@paf31

paf31 commented Aug 31, 2015

Copy link
Copy Markdown
Contributor

Ah, makes sense.

paf31 added a commit that referenced this pull request Aug 31, 2015
@paf31 paf31 merged commit e1037c9 into purescript-contrib:master Aug 31, 2015
@paf31

paf31 commented Aug 31, 2015

Copy link
Copy Markdown
Contributor

Thanks!

@ethul

ethul commented Aug 31, 2015

Copy link
Copy Markdown
Contributor Author

Welcome, thank you for the merge!

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.

2 participants