Created
August 30, 2018 05:51
-
-
Save kartikag01/02c693b9d627b2465b7009b44bedc6b5 to your computer and use it in GitHub Desktop.
react method after change in lifecycle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static getDerivedStateFromProps(nextProps, prevState) { | |
if (prevState.pageNo !== nextProps.pageNo) { | |
return { pageNo: nextProps.pageNo }; | |
} | |
} | |
componentDidUpdate(prevProps) { | |
if (prevProps.pageNo !== this.props.pageNo) { | |
fetchNextPageData(this.props.pageNo); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment